Histogram range and binning in x-axis

Dear Experts,

I am new to Bokeh from physics field.

I wonder if there is a build-in way to generate a histogram with fixed or various binning.

For example, I have df[‘x’] in Gaussian distribution.

I tried:

hist = Histogram(data=df, values=‘x’, bins=30, continuous_range=Range1d(0, 2))
show(hist)

``

But the range is not set to [0,2].

For various reasons, I don’t want to trim my df, like df[df.x>0 & df.x<2].

Another question is, can I use various binning, such as [0, 0.1, 0.3, 0.5, 1.0, 2.0] to generate the histogram?

Sorry if this is already documented somewhere, I couldn’t find an example anywhere.

Thanks,

Quan

Hi Quan,

You want to use the quad glyph. Have a look at this example:

http://bokeh.pydata.org/en/latest/docs/gallery/histogram.html

···

Also, you should browse through the gallery to get a general idea of what is available. Just note that everything in bokeh.charts is being refractored into a separate package, bkcharts.

Good luck,

Steve

On May 11, 2017 5:41 AM, “Quan WANG” [email protected] wrote:

Dear Experts,

I am new to Bokeh from physics field.

I wonder if there is a build-in way to generate a histogram with fixed or various binning.

For example, I have df[‘x’] in Gaussian distribution.

I tried:

hist = Histogram(data=df, values=‘x’, bins=30, continuous_range=Range1d(0, 2))
show(hist)

``

But the range is not set to [0,2].

For various reasons, I don’t want to trim my df, like df[df.x>0 & df.x<2].

Another question is, can I use various binning, such as [0, 0.1, 0.3, 0.5, 1.0, 2.0] to generate the histogram?

Sorry if this is already documented somewhere, I couldn’t find an example anywhere.

Thanks,

Quan

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e1b35548-b9c6-4d74-a5ea-b32b59d90402%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.