Plots in jupyter-lab are displayed inside a scrolling window
If by using layout height is increased the resulting plot is displayed inside a scrolling window. Here is the MWE
using PlotlyLight, DataFrames
n = 100
df = DataFrame(x=rand(n), y=rand(n))
layout = Config(height=800)
trace = Config(x=df.x, y=df.y, type="scatter", mode="markers")
Plot([trace], layout)
In python jupyter's output cell adapts to the size of the plot, resulting in a fully visible plot. Is this something that could be addressed from the package?
Jupyter Lab = 4.2.5 Julia = 1.11
Looking at the produced ipynb file it seems that by default the plot is using IFrame. So if I override show to force rendering using html_div() I can plot the charts where the height is honored.
using PlotlyLight
function Base.show(io::IO, ::MIME"text/html", o::Plot)
show(io, MIME("text/html"), PlotlyLight.html_div(o))
end
trace = Config(type="scatter", x = 1:20, y = cumsum(randn(20)), mode="lines+markers")
layout = Config(height=800)
p = Plot(trace, layout)
So the logic (here) https://github.com/JuliaComputing/PlotlyLight.jl/blob/bb362845b8e4914b0693bccfde01d30d12ce5013/src/PlotlyLight.jl#L153
seems to be the issue
@asbisen , thanks for the hint to enable larger height plots without a scroll bar. I find I can display them directly with,
display(MIME("text/html"), PL.html_div(p))
hence, avoiding the need to override show. However, the plot does not persist after saving and reopening the notebook, which is a drawback if I want to share the notebook with someone who isn't setup to use Julia.