Reputation: 57271
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:
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?
Upvotes: 6
Views: 5568
Reputation: 562
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.
Upvotes: 0
Reputation: 57271
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
Upvotes: 16