Plots do not display, unless I call gui(), when using custom sysimage

Answering my own question, an analogous to what has to be done with Makie (Makie doesn't display plot when using a custom Julia sysimage), one can solve this by running Plots.__init__() after loading Plots.

(In addition it seems also that if the sysimage contains IJulia, the above will not work, nor will gui nor plot(p, show = true); I think this makes sense, but I had a couple of sysimages that, accidentally, included IJulia).

I’ve made a pull request suggesting the use of Plots.__init__() in the example in Creating a sysimage for fast plotting with Plots.jl · PackageCompiler.