GR.jl icon indicating copy to clipboard operation
GR.jl copied to clipboard

Pluto ENV variables

Open fonsp opened this issue 3 years ago • 1 comments

Pluto is a big fan of Plots.jl! The GR interactivity example looks exciting!

Two questions:

First:

https://github.com/jheinen/GR.jl/blob/master/examples/pluto_ex.jl#L25 Would it be helpful if Pluto sets this ENV variable on every notebook process?

Second:

Plots+GR can output both the html and svg mime types, with the same result. However, if a cell's output is of the svg mime type, then Pluto can do some performance optimizations, like here and here. It also allows right click + save figure for Plots.

In Pluto's MIME system, HTML is prioritised over SVG, and I think that it should stay that way. A solution would be to set Base.showable(::MIME"text/html", ::Plots.Plot) = false when Plots is used with the GR backend, but then perhaps Plots would lose support for some frontends.

So what about:

Base.showable(::MIME"text/html", ::Plots.Plot) = get(ENV, "GRDISPLAY", "") == "pluto"

fonsp avatar Nov 01 '20 18:11 fonsp

  1. We still have to make some changes to the JS part and therefore still consider it as beta software. As soon as it is ready for productive use, we can set the environment variable directly in Pluto.

  2. From the point of view of the GR Framework it depends on the complexity of the graphics whether PNG or SVG is better performing within Pluto. At the moment I have no real (good) idea how to use the interactive GR JavaScript features in Plots.jl. Maybe we will have to implement this via a separate display list.

jheinen avatar Nov 02 '20 14:11 jheinen