2024-05-20 16:26:11 发布
网友
我已经阅读了关于bokeh的大部分文档和许多示例。它们都包含默认的方形窗口。我看到的唯一一个稍微有点不同的例子是here,它有子块,在创建Plot对象时设置高度和宽度。
如果已经创建了绘图,则可以使用bokeh.plotting.curplot()函数返回“当前”绘图,然后设置其height和width属性。如果您正在使用低级接口(例如bokeh/examples/glyph/中的示例)构建Plot对象,那么您可以直接在plot对象或Plot()构造函数中设置这些属性。
bokeh.plotting.curplot()
height
width
bokeh/examples/glyph/
Plot
Plot()
或者,如果在bokeh.plotting中使用任何glyph生成函数,则可以传递plot_width和plot_height关键字参数,例如:
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)
很抱歉回答我自己的问题,这其实很简单。
bokeh.plotting.curplot().plot_height=400 bokeh.plotting.curplot().plot_width=800
您可以将plot_width/plot_height命令添加到figure命令本身。注意,您还可以通过tools关键字var中的resize将resize工具添加到工具集,这会很有帮助。
bokeh.plotting.figure(x_axis_type = "datetime", tools="pan,wheel_zoom,box_zoom,reset,resize,previewsave",plot_width=1000, name="myplot")
如果已经创建了绘图,则可以使用
bokeh.plotting.curplot()
函数返回“当前”绘图,然后设置其height
和width
属性。如果您正在使用低级接口(例如bokeh/examples/glyph/
中的示例)构建Plot
对象,那么您可以直接在plot对象或Plot()
构造函数中设置这些属性。或者,如果在
bokeh.plotting
中使用任何glyph生成函数,则可以传递plot_width
和plot_height
关键字参数,例如:很抱歉回答我自己的问题,这其实很简单。
您可以将plot_width/plot_height命令添加到figure命令本身。注意,您还可以通过tools关键字var中的resize将resize工具添加到工具集,这会很有帮助。
相关问题 更多 >
编程相关推荐