histogram

Meaning of Histogram on Tensorboard

我的梦境 提交于 2019-12-02 19:38:32
I am working on Google Tensorboard, and I'm feeling confused about the meaning of Histogram Plot. I read the tutorial, but it seems unclear to me. I really appreciate if anyone could help me figure out the meaning of each axis for Tensorboard Histogram Plot. Sample histogram from TensorBoard marc_alain I came across this question earlier, while also seeking information on how to interpret the histogram plots in TensorBoard. For me, the answer came from experiments of plotting known distributions. So, the conventional normal distribution with mean = 0 and sigma = 1 can be produced in TensorFlow

How to get data in a histogram bin

我与影子孤独终老i 提交于 2019-12-02 19:22:51
I want to get a list of the data contained in a histogram bin. I am using numpy, and Matplotlib. I know how to traverse the data and check the bin edges. However, I want to do this for a 2D histogram and the code to do this is rather ugly. Does numpy have any constructs to make this easier? For the 1D case, I can use searchsorted(). But the logic is not that much better, and I don’t really want to do a binary search on each data point when I don’t have to. Most of the nasty logic is due to the bin boundary regions. All regions have boundaries like this: [left edge, right edge). Except the last

Matplotlib: plotting transparent histogram with non transparent edge

天大地大妈咪最大 提交于 2019-12-02 19:08:28
I am plotting a histogram, and I have three datasets which I want to plot together, each one with different colours and linetype (dashed, dotted, etc). I am also giving some transparency, in order to see the overlapping bars. The point is that I would like the edge of each bar not to become transparent as the inner part does. Here is an example: import matplotlib.pyplot as plt import numpy as np x = np.random.random(20) y =np.random.random(20) z= np.random.random(20) fig = plt.figure() ax = fig.add_subplot(111) ax.hist(x, bins=np.arange(0, 1, 0.1), ls='dashed', alpha = 0.5, lw=3, color= 'b')

get bins coordinates with hexbin in matplotlib

巧了我就是萌 提交于 2019-12-02 18:33:32
I use matplotlib's method hexbin to compute 2d histograms on my data. But I would like to get the coordinates of the centers of the hexagons in order to further process the results. I got the values using get_array() method on the result, but I cannot figure out how to get the bins coordinates. I tried to compute them given number of bins and the extent of my data but i don't know the exact number of bins in each direction. gridsize=(10,2) should do the trick but it does not seem to work. Any idea? user1868739 I think this works. from __future__ import division import numpy as np import math

Matplotlib histogram with collection bin for high values

痞子三分冷 提交于 2019-12-02 18:08:44
I have an array with values, and I want to create a histogram of it. I am mainly interested in the low end numbers, and want to collect every number above 300 in one bin. This bin should have the same width as all other (equally wide) bins. How can I do this? Note: this question is related to this question: Defining bin width/x-axis scale in Matplotlib histogram This is what I tried so far: import matplotlib.pyplot as plt import numpy as np def plot_histogram_01(): np.random.seed(1) values_A = np.random.choice(np.arange(600), size=200, replace=True).tolist() values_B = np.random.choice(np

R: Control number of histogram bins

☆樱花仙子☆ 提交于 2019-12-02 17:44:00
问题 I am using the hist-function to analyze some data I generated. For an analysis-assay I would like to precisely control the number of histogram bins. I know the "break-argument" and I can see that in many cases the number of bins is in a direct relationship to the number of breaks (i.e. no_bins = no_breaks + 1). Due to R's algorithm this is not always the case. Is there a way to force R to output a specific number of bins? Let me know if I need to specify further details. Best and many thanks!

Python histogram outline

核能气质少年 提交于 2019-12-02 16:59:00
I have plotted a histogram in Jupyter (Python 2) and was expecting to see the outlines of my bars but this is not the case. I'm using the following code: import matplotlib.pyplot as plt from numpy.random import normal gaussian_numbers = normal(size=1000) plt.hist(gaussian_numbers) plt.title("Gaussian Histogram") plt.xlabel("Value") plt.ylabel("Frequency") plt.show() It looks like either your linewidth was set to zero or your edgecolor was set to 'none' . Matplotlib changed the defaults for these in 2.0. Try using: plt.hist(gaussian_numbers, edgecolor='black', linewidth=1.2) 来源: https:/

Why is facet_grid placing the distributions in the wrong quadrants?

﹥>﹥吖頭↗ 提交于 2019-12-02 16:41:28
问题 When using facet_grid(x ~ y) with ggplot2 I've seen in various examples and read in the documentation that the x variable is laid out vertically and the y variable horizontally. However, when I run the following: set.seed(1) b = c(rnorm(10000,mean=0,sd=0.5),rnorm(10000,mean=5,sd=0.5), rnorm(10000,mean=7,sd=0.5),rnorm(10000,mean=10,sd=0.5)) x = c(rep('xL', 20000), rep('xR',20000)) y = c(rep('yL',10000), rep('yR',20000), rep('yL',10000)) foo = data.frame(x=x,y=y,b=b) ggplot(data=foo, aes(foo$b)

Why does the 'set table' option in Gnuplot re-write the first entry in the last line?

白昼怎懂夜的黑 提交于 2019-12-02 14:13:41
问题 I am trying to create a histogram from some data I have and just to get an idea of the frequencies and bins etc I set a table so that instead of plotting it it put the information about the histogram into a particular file. So for example if my data was 11 12 11 11 15 12 10 then I get something like 10 1 11 3 12 2 15 1 where the second column gives the frequencies of each entry. But what I've noticed is that when gnuplot creates this file, instead of getting what I get above I get 10 1 11 3

How to Fit to The Outer Shell of a Function

十年热恋 提交于 2019-12-02 13:55:26
问题 I am trying to make a gaussian fit on a function that is messy. I want to only fit the exterior outer shell (these are not just the max values at each x, because some of the max values will be too low too, because the sample size is low). from scipy.optimize import curve_fit def Gauss(x, a, x0, sigma, offset): return a * np.exp(-np.power(x - x0,2) / (2 * np.power(sigma,2))) + offset def fitNormal(x, y): popt, pcov = curve_fit(Gauss, x, y, p0=[np.max(y), np.median(x), np.std(x), np.min(y)])