如何改变散景图的大小

Phi*_*oso 30 python plot bokeh

我已经阅读了大部分有关散景和许多示例的文档.它们都包含默认的方形窗口.我看到的唯一例子是稍微不同的是这里有子图并在创建Plot对象时设置高度和宽度.

Pet*_*ang 28

如果您已经创建了图,那么您可以使用该bokeh.plotting.curplot()函数返回"当前"图,然后设置其heightwidth属性.如果Plot使用较低级别的接口构建对象(例如,中的示例bokeh/examples/glyph/,则可以直接在绘图对象或Plot()构造函数中设置这些属性.

或者,如果您正在使用任何字形生成函数bokeh.plotting,则可以传递plot_widthplot_height关键字参数,例如:

line(x,y, color="#0000FF", tools="pan,wheel_zoom,box_zoom,reset",
     name="line_example", plot_width=800, plot_height=300)
Run Code Online (Sandbox Code Playgroud)

  • 仅供参考,在散景0.12中我相信您可以将其设置为bokeh.plotting.figure()中的关键字,如下所述.**但是**,正确的关键字是'width'和'height',而不是'plot_width'和'plot_height'.而且,我认为值必须是整数,而不是浮点数.由于我的数字是嵌入式的,而且我正在修改服务器,这花了我一段时间来计算.我在他们的'figure()'文档中找不到这些信息,只是一个例子.希望能帮助到你.通过举例说明:exampleFig = bokeh.plotting.figure(width = 200,height = 200) (2认同)

Pau*_*aul 11

您可以将plot_width/plot_height命令添加到figure命令本身.请注意,您还可以通过工具关键字var中的resize将调整大小工具添加到工具集中,这可能会有所帮助.

bokeh.plotting.figure(x_axis_type = "datetime",    
  tools="pan,wheel_zoom,box_zoom,reset,resize,previewsave",plot_width=1000, 
  name="myplot")
Run Code Online (Sandbox Code Playgroud)


Phi*_*oso 6

很抱歉回答我自己的问题,这实际上很简单.

bokeh.plotting.curplot().plot_height=400
bokeh.plotting.curplot().plot_width=800
Run Code Online (Sandbox Code Playgroud)

  • curplot()已被弃用了一段时间.您可以在此处查看更多信息:http://continuum.io/blog/bokeh-0.7#api-deprecations现在,API更加明确.基本上你要跟踪你想要采取行动的情节(更好):p = figure(...); p.circle(...); p.plot_height = 400; 秀(P) (5认同)