PlutoPlotly and PlotlyJS: subplots

Hi @VivMendes the problem here is that the function make_subplots is defined inside PlotlyJS and not inside PlotlyBase and it automatically create a SyncPlot (also from PlotlyJS) rather than a normal Plot object.

the function is quite simple, so for the time being you can just plug in this code to make it work:

begin
	fig= Plot(Layout(Subplots(rows=1, cols=2, subplot_titles=["Some noise" "More noise"])))
	add_trace!(fig, scatter(;x=1:50, y=rand(50), name = "some"),  row=1, col=1)
	add_trace!(fig, scatter(;x=1:50, y=rand(50), name = "more"), row=1, col=2)
	relayout!(fig, hovermode="x")
	add_vrect!(fig,  5, 10,  fillcolor = "red", opacity = 0.2, line_width = 0; row=1, col=1)
	add_vrect!(fig,  20, 26,  fillcolor = "blue", opacity = 0.2, line_width = 0; row=1, col=2)
	PlutoPlotly.plot(fig) # This need to be the `plot` function from PlutoPlotly, not from PlotlyJS
end

Now that I am back from holidays I have to work on some backlog stuff on PlutoPlotly to fix some things and make it more compliant with standard PlotlyJS usage, so hopefully within the next week or so you could still use the same code you use in PlotlyJS outside of Pluto without modifications.
Remember though that PlutoPlotly and PlotlyJS are not supposed to be imported together (at least not both with using) in a single notebook.
I will also try to adapt PlutoPlotly to be compliant with the recent JuliaPlots/PlotlyKaleido.jl (github.com) so that you don’t have to load PlotlyJS to use savefig anymore.

3 Likes