6

How can I remove all whitespace surrounding a Bokeh plot?

I use the Bokeh plotting interface to produce the following image with progressbars for my project:

enter image description here

From various other stack overflow questions I can figure out how to turn off the grid lines, the tick marks, the labels. However I haven't yet figured out how to cleanly remove all horizontal and vertical padding.

What is a comprehensive what to remove all visual elements and padding from the canvas other than what I explicitly add?

2 Answers 2

16

It appears that one is meant to set the minimum border attributes on the figure:

fig.min_border_left = 0
fig.min_border_right = 0
fig.min_border_top = 0
fig.min_border_bottom = 0

http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#border

Sign up to request clarification or add additional context in comments.

3 Comments

just min_border should set all of them at once
Oh neat. Want to put up an answer?
works for top and bottom but not for left and right where the border still exists
0

I actually had this problem while trying to work with image_url in a figure, which took a good amount of time. After digging into the bokeh's documentation I figured the best option to control the figure dimensions and plot was use frame_width and frame_height combined with the plot width and height.

p = figure(plot_width=640, plot_height=180, frame_width=650, tools='', x_axis_location = None, y_axis_location = None)

this way I could control exactly the dimensions and from now on it will be quiet easy to deal with, in case someone faces the same problem and the solution of the bokeh's wizard does not fulfil the your aim.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.