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
JunoDisplayto the top of the display stack. -
display(::JunoDisplay, x)catches everything. - If there’s an appropriate
showmethod forxand the plot pane is enabled in the settings we displayxin the plot pane (by callingshowon it). “Appropriateshowmethod” means most image mime types (image/svg+xml,image/png,image/jpeg,image/tiff,image/bmp,image/gif) as well asapplication/juno+plotpanewhich allows you to use arbitrary HTML. - If there’s no appropriate
showmethod 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.