【发布时间】:2014-03-25 16:43:04
【问题描述】:
我已经阅读了大部分关于散景的文档和许多示例。它们都包含默认的方形窗口。我看到的唯一一个稍微不同的例子是here,它有子图并在创建 Plot 对象时设置高度和宽度。
【问题讨论】:
我已经阅读了大部分关于散景的文档和许多示例。它们都包含默认的方形窗口。我看到的唯一一个稍微不同的例子是here,它有子图并在创建 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 命令添加到图形命令本身。请注意,您还可以通过 tools 关键字 var 中的 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
很抱歉回答我自己的问题,这实际上很容易。
bokeh.plotting.curplot().plot_height=400
bokeh.plotting.curplot().plot_width=800
【讨论】: