cjdoris / Bokeh.jl

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

Diagram gets not resized when window size is changing #14

Closed ufechner7 closed 1 year ago

ufechner7 commented 1 year ago

I have the following code:

using Bokeh, BokehBlink
Bokeh.settings!(display=:blink)

function plot(x, y; keywords...)
    p = figure()
    Bokeh.plot!(p, Bokeh.Line; x=x, y=y, keywords...)
    display(p)            
end
#########################################
x  = 0:0.01:100
y1 = sin.(x)

plot(x, y1)
nothing

A window pops up showing a sinus function. Nice!

But if I resize the window, the size of the plot stays the same. That is very inconvenient.

cjdoris commented 1 year ago

Hello! For now you must do

p = figure(; sizing_mode="stretch_both")

to have the figure automatically stretch to fit the window.

It would be nice to do this automatically, but the natural way to implement this is via themes, but I don't have themes yet.

cjdoris commented 1 year ago

Hello again. It turns out I had already implemented most of the theming functionality, which I have now tidied up and released. Long story short, your plots should now automatically stretch to fill the window when you resize it (you can still override this behaviour with the sizing_mode argument from my previous reply.)