Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change size of bokeh figure

Tags:

python

plot

bokeh

I have read most of the documentation on bokeh and many of the examples. All of them contain the default square window. The only example I have seen that is the slightly different is here which has subplots and sets height and width in the creation of a Plot object.

like image 207
Philliproso Avatar asked Feb 24 '14 06:02

Philliproso


People also ask

How do you change the size of Bokeh?

You can add the plot_width/plot_height commands to the figure command itself. Notice you can also add the resize tool to the set of tools via resize in the tools keyword var, which can be helpful.

How do I get rid of gridlines in Bokeh?

You can hide the lines by setting their grid_line_color to None .

How do you find the Bokeh figure?

You can display images on Bokeh plots using the image() , image_rgba() , and image_url() glyph methods. You can use hovering tooltips with image glyphs to let the user see the values of each pixel.

Does Bokeh work with Pandas?

Pandas-Bokeh provides a Bokeh plotting backend for Pandas, GeoPandas and Pyspark DataFrames, similar to the already existing Visualization feature of Pandas. Importing the library adds a complementary plotting method plot_bokeh() on DataFrames and Series.


1 Answers

If you've already created the plot, then you can use the bokeh.plotting.curplot() function to return the "current" plot, and then set its height and width attributes. If you are building up a Plot object using the lower-level interfaces (e.g. the examples in bokeh/examples/glyph/, then you can just set those attributes directly as well on the plot object or in the Plot() constructor.

Alternatively, if you are using any of the glyph generation functions in bokeh.plotting, you can pass the plot_width and plot_height keyword arguments, e.g.:

line(x,y, color="#0000FF", tools="pan,wheel_zoom,box_zoom,reset",      name="line_example", plot_width=800, plot_height=300) 
like image 175
Peter Wang Avatar answered Sep 20 '22 02:09

Peter Wang