I’m in the process of redesigning Plots.jl’s and GR’s display system such that it works well with Juno.
Both of those packages don’t really make use of Base’s display system, which is kind of unfortunate.
PR for Plots.jl:
https://github.com/JuliaPlots/Plots.jl/pull/1667
GR should imho follow the same design – push a GRDisplay <: AbstractDisplay
to the Base display stack and provide the correct show
and display
methods. That would probably require a bit of a redesign of GR because e.g. plot()
returns nothing
instead of something Juno (or the REPL) can call show
on.
Short description of how Juno handles plots right now:
- We push a
JunoDisplay
to the top of the display stack. -
display(::JunoDisplay, x)
catches everything. - If there’s an appropriate
show
method forx
and the plot pane is enabled in the settings we displayx
in the plot pane (by callingshow
on it). “Appropriateshow
method” means most image mime types (image/svg+xml
,image/png
,image/jpeg
,image/tiff
,image/bmp
,image/gif
) as well asapplication/juno+plotpane
which allows you to use arbitrary HTML. - If there’s no appropriate
show
method or the plot pane is disabled we don’t do anything and let the rest of the display stack handle displaying the plot. This is wherePlotsDisplay
(or the hypotheticalGRDisplay
) comes is relevant.