I think this topic has come up before, but i don't think anything has resulted from it.
I'd like a way for saving a plot from from matplotlib, so that it can be re-rendered later, possibly with a different backend, maybe to a different size, and maybe with changes to the labels. This would save me having to rerun the simulation that generated the plot.
Ideally this would work by having a save_plot() function, that would save all state of the current plot into a file. This could then be loaded by a program to regenerate that plot.
I have made a rough prototype to demonstrate. It is incomplete. It only implements a very small subset of pylab.
I shall attach some files (if these get mangled, then i can upload them somewhere).
example1 and example2 are what the plot files might look like.
plot.py renders the plot files.
plot.py example2 example.png
fakepylab.py is a wrapper around pylab that record you plotting, and offers a save_plot() function
test.py is script that uses fakepylab to create a plot file.
So does any of this look useful? What more might it need to be useful?
Any comments on the file format. Is there an existing standard that could be used instead? Would XML be better than plain ascii?
example1 (159 Bytes)
example2 (305 Bytes)
fakepylab.py (913 Bytes)
plot.py (1.41 KB)
test.py (120 Bytes)