Save shape settings after interactive setup

I often use matplotlib to quickly display data, then come back later and adjust my build code to make nice numbers. In this process, I often use the interactive chart window to adjust things like spacing, scaling, cropping, etc. Although I can easily save the resulting shape in an image file, I really want to save the sequence of calls / parameters of the functions that made it.

Please note that I didn’t really want to open the same shape again (as in Saving Matplotlib Interactive Shapes ). It would be useful even that which is simple, as an opportunity to print various properties of a figure and axes.

+3
source share
2 answers

While I have no answer to your specific question, I would suggest using an Ipython Notebook for these things (and much more!)

Make sure you have %pylab inlineone in the cell.

When you create a story, it will display it in the notebook itself. Then inside your camera, just keep experimenting until you get it right (use Ctrl-Enterin the cell). Now the cell will have all the statements you need (and no more!)

The difference between the command line interpreter and the notebook is that all the previous instructions you entered led to a lot of interference. Using a laptop, you can edit the line in place.

+1
source

A .

: MatPlotLib . . . :

fig, ax = matplotlib.pyplot.subplots()
# plot some stuff

import pickle
pickle.dump(  fig,  open('SaveToFile.pickle',  'wb')  )

, , GUI. Unpickling pickle.load() - CLI GUI.

+1

All Articles