cjdoris / Bokeh.jl

Interactive plotting made easy
https://cjdoris.github.io/Bokeh.jl
Other
77 stars 3 forks source link

Possible to resize a figure ? #11

Closed RGerzaguet closed 2 years ago

RGerzaguet commented 2 years ago

Hello, Thanks for the package and bindings :) Small question, is it possible to allow window resizing ? I use Blink backend but resize the window does not affect the plot. Maybe there is some hidden keywords to set to the figure ? MWE

# Dependencies
using Bokeh, BokehBlink 
Bokeh.settings!(display=:blink)
# Create a figure, with Hovertool (not enable by default)
p = figure(;tools = [WheelZoomTool(), PanTool(), ResetTool(),BoxZoomTool(),HoverTool(),SaveTool()])
# A minimal figure
plot!(p, Scatter, x=randn(1000), y=randn(1000)) |> display 

Thanks in advance @+R

cjdoris commented 2 years ago

I believe you can do this yourself by setting the sizing mode on the figure: https://docs.bokeh.org/en/latest/docs/user_guide/layout.html#sizing-modes

It would be good to add an option to BokehBlink to do this automatically.

RGerzaguet commented 2 years ago

Thanks for the pointers, So it is basically

p = figure(;tools = [WheelZoomTool(), PanTool(), ResetTool(),BoxZoomTool(),HoverTool(),SaveTool()],sizing_mode="stretch_both")
plot!(p, Line, x=randn(1000), y=randn(1000))

Easy peasy, thanks a lot @+R