Holoviews直方图不再正确绘制,产生奇怪的图形

时间:2018-05-29 20:50:06

标签: pandas bokeh holoviews

我从Holoviews网站上获取了示例并绘制了以下直方图

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

并获得以下图表:

wrong graph

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

任何人都可以解释这里发生的事情吗?即使将代码更改为

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

我仍然得到相同的错误图表。

0 个答案:

没有答案