# How to save a plot structure

**URL:** https://discourse.julialang.org/t/how-to-save-a-plot-structure/28694
**Category:** General Usage
**Tags:** plots, vegalite
**Created:** [September 12, 2019, 3:26pm UTC](https://discourse.julialang.org/t/how-to-save-a-plot-structure/28694 "2019-09-12T15:26:23Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)
#### Post date: [September 18, 2019, 11:21pm UTC](https://discourse.julialang.org/t/how-to-save-a-plot-structure/28694/5 "2019-09-18T23:21:04Z")

</div>

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](http://docs.juliaplots.org/latest/backends/#hdf5-hdf5-plots)

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

```julia
#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.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-save-a-plot-structure/28694)._
