Hi.
As far as I could find, we cannot use Interact.@manipulate
with PlotlyJS
in a Jupyterlab notebook to make interactive plots. I was able to use GR
and PyPlot
but I prefer using PlotlyJS
because it allows me to update the curves without redrawing the whole plot and it also gives interactivity like zooming etc.
So I switched from Jupyterlab to Blink.jl
. The following code almost works:
using Interact: slider, on, vbox, @dom_str
using PlotlyJS: plot, restyle!, scatter
using Blink: Window, body!
win = Window()
x = collect(0.0:0.01:2π)
y = sin.(x)
trace = scatter(x=x, y=y)
p = plot(trace)
function updateplot(i)
y = sin.(i*x)
restyle!(p, 1, y=[y])
end
sli = slider(1:100, label="i")
on(updateplot, sli)
ui = dom"div"(vbox(sli, p))
body!(win, ui)
But the size of the plot is a little too big due to which a scroll bar appears and I cannot see the full plot and the slider together. Is there a way to fit things properly so that scroll bar does not appear?
Regards,
Amit