Correct way of saving properties for plot reconstruction

Dear list,

apologies for what might be a simple question. I am creating an application that uses matplotlib for plotting, using the Qt4Agg backend. I can create the figures without a problem.

However, I wish to save the state of the application, including the graphs. The complicating factor is that the user may have altered the appearance of the graphs via a NavigationToolbar.

I have no problems saving the data that makes up the graphs, but how do I save the properties of the graphs (line colour, linewidth, etc)?

I tried using matplotlib.artist.ArtistInspector(Line2D).properties(). This gives a dictionary of all the properties. However, when I try to pickle this I get picking errors:

cPickle.PicklingError: Can’t pickle <class ‘matplotlib.axes.AxesSubplot’>: attribute lookup matplotlib.axes.AxesSubplot failed

I am sure that there is an easy way of achieving this, I just can’t see it in the documentation. I appreciate any help the list is able to give me.

regards,

Andrew

···


Dr. Andrew Nelson


Dear list,
apologies for what might be a simple question. I am creating an
application that uses matplotlib for plotting, using the Qt4Agg backend.
  I can create the figures without a problem.

However, I wish to save the state of the application, including the
graphs. The complicating factor is that the user may have altered the
appearance of the graphs via a NavigationToolbar.

I have no problems saving the data that makes up the graphs, but how do
I save the properties of the graphs (line colour, linewidth, etc)?
I tried using matplotlib.artist.ArtistInspector(Line2D).properties().
This gives a dictionary of all the properties. However, when I try to
pickle this I get picking errors:

cPickle.PicklingError: Can't pickle <class
'matplotlib.axes.AxesSubplot'>: attribute lookup
matplotlib.axes.AxesSubplot failed

I am sure that there is an easy way of achieving this, I just can't see
it in the documentation. I appreciate any help the list is able to give me.

Maybe there is not an easy way...
See https://github.com/matplotlib/matplotlib/pull/1020.

Eric

···

On 2012/08/23 6:52 PM, Andrew Nelson wrote:

regards,
Andrew