Bob*_*ain 6 python bokeh holoviews
我一直在尝试在使用 Holoviews 和 Bokeh 时设置标题。我将 3 个图相互叠加。代码如下所示:
%%opts Curve [width=900 height=400 show_grid=True tools=['hover'] finalize_hooks=[apply_formatter]]
%%opts Curve (color=Cycle('Category20'))
%%opts Overlay [ legend_position='bottom' ] Curve (muted_alpha=0.5 muted_color='black' )
actual_curve = hv.Curve(df_reg_test, 'date', 'y', label='Actual')
existing_curve = hv.Curve(df_reg_test, 'date', 'Forecast Calls', label='Existing Forecast')
xgb_curve = hv.Curve(df_reg_test, 'date', 'xgb_pred', label='New Forecast')
actual_curve * existing_curve * xgb_curve
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,各个曲线的标签在图例中显示得很好,但我在图的顶部没有得到标题。
如何手动设置标题?
我发现我可以在叠加选项中添加一个 title_format="my new title" 选项:
%%opts Curve [width=900 height=400 show_grid=True tools=['hover'] finalize_hooks=[apply_formatter]]
%%opts Curve (color=Cycle('Category20'))
%%opts Overlay [ legend_position='bottom' title_format="my new title"] Curve (muted_alpha=0.5 muted_color='black' )
actual_curve = hv.Curve(df_reg_test, 'date', 'y', label='Actual')
existing_curve = hv.Curve(df_reg_test, 'date', 'Forecast Calls', label='Existing Forecast')
xgb_curve = hv.Curve(df_reg_test, 'date', 'xgb_pred', label='New Forecast')
actual_curve * existing_curve * xgb_curve
Run Code Online (Sandbox Code Playgroud)
现在我的情节有一个标题:
归档时间: |
|
查看次数: |
3747 次 |
最近记录: |