I can set a figures width by doing:
fig.width = 1000
however this gives me a smaller figure if I have more then one yaxis, or if I have text in the yaxis, or if I have a legend on the left or the right, or longer text in the legend.
Is there a way of setting the width of the actual figure specifically?
What your are asking for are the *frame_*units. Use frame_height
and frame_width
to define the height and width of the inner figure.
Here is an example to see the different visual outputs.
Here is the code to reproduce the result.
from bokeh.layouts import layout
from bokeh.plotting import figure, show, output_notebook
output_notebook()
p1 = figure(
frame_width=300,
frame_height=300,
title="frame units"
)
p1.scatter([1,2,3],[1,2,3])
p2 = figure(
width=300,
height=300,
title="componet units"
)
p2.scatter([1,2,3],[1,2,3])
p3 = figure(
frame_width=300,
frame_height=300,
title="frame units no toolbar",
toolbar_location=None
)
p3.scatter([1,2,3],[1,2,3])
p4 = figure(
width=300,
height=300,
toolbar_location=None,
title="componet units no toolbar"
)
p4.scatter([1,2,3],[1,2,3])
show(layout([[p1, p2], [p3, p4]]))