On Wednesday 25 February 2009 09:35:07 am sam tygier wrote: > 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. > eg. > plot.py example1 > 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? > > Sam Tygier
I think this is a good idea, but why don't you just save your data to a file and plot from a different script. If the data is only numbers you can just do savetxt('data.dat',data) in you simulation script and then data=loadtxt('data.dat') from your plot script... Now if you also just use savefig('fig') without suffix, you can just run your plot script like: python plot.py -DAgg or -DPS or whatever and it will plot to the default format for that backend. Best regards Troels Kofoed Jacobsen ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel