Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Reference

http://holoviews.org/reference/elements/bokeh/Histogram.html

Comments

  1. HoloViews.Histogram takes the output of np.histogram as input and generate a histogram plot.

import numpy as np
import holoviews as hv

hv.extension("bokeh")
Loading...
Loading...
Loading...

Generate a histogram from a bunch of values.

np.random.seed(1)
data = np.random.randn(10000)
hist = np.histogram(data, 20)
hv.Histogram(hist)
Loading...

Multiple histograms on the same plot.

from bokeh.sampledata.autompg import autompg

autompg_ds = hv.Dataset(autompg)
%%opts Histogram (alpha=0.9) [width=600]
autompg_ds.hist(dimension='mpg', groupby='cyl', adjoin=False)
Loading...

Make Histogram From Frequencies and Edges

np.random.seed(1)
data = np.random.randn(10000)
frequencies, edges = np.histogram(data, 20)
print("Values: %s, Edges: %s" % (frequencies.shape[0], edges.shape[0]))
hv.Histogram((edges, frequencies))