3

What is the keyword to turn off the interactivity or responsiveness in the plotly backend for the Plots.jl package in Julia?

For reference, I am using Pluto and while the interactivity is great, I am doing some very dense scatter plots (>1000 points) with a great number of subplots (>100). The default hover and interactivity features end up consuming a lot of memory when the HTML is displayed (with the saved HTML files themselves being over 50 MB in size). This causes Chrome/Safari to crash.

I am looking for a way to turn off the interactivity. For various reasons (documented here and here) I am stuck with using the plotly backend (I figured out how to save to PDF, but I also want to save to HTML; albeit with interactivity turned off).

I tried keywords like static=true or responsive=false etc. but it didn't work. Using hover=false turned off the tooltip but not the rest of the interactivity.

ITA
  • 3,200
  • 3
  • 18
  • 32
  • I don't think with Plots.jl at the moment. It can be done with Julia implementations of PlotlyJS or Dash. They allow setting `staticPlot` to `true` in a graph's `config`. Doesn't seem possible to pass this to the figure using Plots.jl. – 5eb Apr 08 '23 at 19:04

1 Answers1

0

The feature currently doesn't exist but there is an option for Pluto notebooks using the PlutoPlotly package directly.

using PlutoPlotly

d = 5; # number of (random) datapoints

N = 6; # grid size N x N

begin
    fig=Plot(Layout(template=templates.plotly_dark,
            Subplots(rows=N, cols=N,
                        shared_xaxes=true, shared_yaxes=true)), 
        config=PlotlyBase.PlotConfig(staticPlot=true)
    )
    for row in 1:N for col in 1:N
        add_trace!(fig,
                scatter(x=1:d, y=rand(d), showlegend=false),
                row=row, col=col,
        )
    end end
    PlutoPlot(fig) # This is the `plot` function from PlutoPlotly, not from PlotlyJS
end

This question is cross posted, with original answer given here: https://discourse.julialang.org/t/turn-off-interactivity-responsiveness-in-plotly-plotlyjs-backend/97225

jd-foster
  • 1
  • 2
  • 3
    Discourse posts tend to be long and far more chatty than StackOverflow. If you are posting an answer, it is better to provide a synopsis/answer here than just post a link; editing your answer to reflect the same. – ITA Apr 14 '23 at 11:15
  • 1
    Cross posting questions verbatim across other programming forums is generally considered poor form, if only for the reason that you use up the time of multiple people. While this answer may be deleted, it seems reasonable that you also update or even remove your question if it is answered satisfactorily elsewhere, or respond in that forum if it is not. – jd-foster Apr 15 '23 at 08:02