ITA
ITA

Reputation: 3870

How to turn off interactivity/responsiveness for plotly backend in Plots.jl

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.

Upvotes: 3

Views: 298

Answers (1)

jd-foster
jd-foster

Reputation: 1

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

Upvotes: 0

Related Questions