0

I took the example from the Holoviews website and plotted the following histogram

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))

and obtained the following graph:

wrong graph

This was the associated error output from Jupyter Notebook:

C:\ProgramData\Anaconda3\lib\site-packages\bokeh\models\sources.py:138: 
BokehUserWarning: ColumnDataSource's columns must be of the same length. 
Current lengths: ('left', 19), ('right', 19), ('top', 21)
"Current lengths: %s" % ", ".join(sorted(str((k, len(v))) for k, v in 
data.items())), BokehUserWarning))

Can anyone explain what's happening here? Even after changing the code to

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[:-1], frequencies))

I still get the same wrong graph.

Pallen
  • 131
  • 8
  • Could you add the versions of bokeh and holoviews, ``import bokeh; import holoviews as hv; print(hv.__version__, bokeh.__version__)``? This seems to work fine with holoviews 1.10.x and bokeh 0.12.16. – philippjfr May 29 '18 at 21:10
  • Ah i see. I was using Holoviews 1.9.4-x-g73c2735e7 & Bokeh 0.12.14 – Pallen May 30 '18 at 13:17
  • And now it works with the updated versions: 1.10.4 0.12.16 – Pallen May 30 '18 at 13:28

0 Answers0