How to save a plot structure

Yes @HenriDeh:
It sounds to me like what you are looking for is exactly what the “hdf5-plots” feature of Plots.jl was designed to do.

You can find a simple example in the documentation here:
Backends · Plots

But just to keep from making you search, I will copy it here:

#First, generate your plot using Plots.jl:
using Plots
hdf5() #Select HDF5-Plots "backend"
p = plot(...) #Construct plot as usual

#Then, write to .hdf5 file:
Plots.hdf5plot_write(p, "plotsave.hdf5")

#After you re-open a new Julia session, you can re-read the .hdf5 plot:
using Plots
pyplot() #Must first select some backend
pread = Plots.hdf5plot_read("plotsave.hdf5")
display(pread)

If you cannot seem to get this working, please let me know.

3 Likes