http://holoviews.org/reference/elements/bokeh/Bars.html中的最后一个示例无效。
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-41-40b1ef4f775a> in <module>()
4 keys = product(index, groups)
5 bars = hv.Bars([k+(np.random.rand()*100.,) for k in keys],
----> 6 ['Index', 'Group'], 'Count')
7 bars.relabel(group='Grouped') + bars.relabel(group='Stacked')
TypeError: __init__() takes 2 positional arguments but 4 were given
如何在该链接的最后一个图中获得分组条形图?另外,我不想要标签&#34; a&#34;和&#34; b&#34;在每个酒吧下面。只是小组标签&#34; A&#34;和&#34; B&#34;。
的软件包:
bokeh=0.12.7=py36_0
holoviews=1.8.4=py36h6f73470_0
jupyter=1.0.0=py36_3
jupyter_client=5.1.0=py36h9902a9a_0
更新
http://holoviews.org/gallery/demos/bokeh/bars_economic.html中的示例也不起作用。类似的错误。我能够通过将脚本更改为:
来使其工作macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\t')
key_dimensions = [('year', 'Year'), ('country', 'Country')]
value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),
('gdp', 'GDP Growth'), ('trade', 'Trade')]
macro = hv.Table(macro_df)
然后:
%%opts Bars [stack_index=1 xrotation=90 width=600 show_legend=False tools=['hover']]
%%opts Bars (color=Cycle('Category20'))
macro.to.bars(kdims=['year', 'country'], vdims='trade', groupby=[]).redim.label(year="Year", trade="Trade")
请注意,某些变量尚未使用。