我已经阅读了Bokeh的大部分文档和很多示例。它们全部都包含默认的正方形窗口。我看到唯一略有不同的示例是这里,它包含子图并在创建Plot对象时设置了高度和宽度。
bokeh.plotting.curplot()
函数返回“当前”图表,然后设置其height
和width
属性。如果您正在使用较低级别的界面构建Plot
对象(例如,在bokeh/examples/glyph/
中的示例),则也可以直接在图表对象或Plot()
构造函数中设置这些属性。bokeh.plotting
中的任何绘制函数,则可以传递plot_width
和plot_height
关键字参数,例如:line(x,y, color="#0000FF", tools="pan,wheel_zoom,box_zoom,reset",
name="line_example", plot_width=800, plot_height=300)
您可以将plot_width/plot_height命令添加到figure命令本身中。请注意,您还可以通过将resize添加到工具关键字变量中的工具集中,这可能会有所帮助。
bokeh.plotting.figure(x_axis_type = "datetime",
tools="pan,wheel_zoom,box_zoom,reset,resize,previewsave",plot_width=1000,
name="myplot")
ValueError: unexpected tool name 'resize', similar tools are reset
。 - kbrosebokeh.plotting.curplot().plot_height=400
bokeh.plotting.curplot().plot_width=800
p = figure(...); p.circle(...); p.plot_height=400; show(p)
- Peter Wangp
的数字,您可以简单地执行以下操作。p.plot_height=400
p.plot_width=800
(Bokeh version 2.4.3)
figsize
的参数用于设置绘图的大小。count_df.plot_bokeh(
title="Replenishment Count",
xlabel="Date",
ylabel="Number of Replenishment",
figsize=(1000, 800),
)
注意:仅适用于数据框中的plot_bokeh
方法。