-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Cannot pickle figure
or axes
(TypeError: instancemethod)
#3392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
what version of mpl? Can you test with 1.4.0rc4? |
mpl version 1.3.1 . I can check 1.4.0rc4 later, but I was kind of expecting that it would be more or less "working" with 1.3.x |
There was a bunch of work done in the last year on pickling so it might already be fixed (just not released). Once we release 1.4.0 (which should be very soon) we will no longer support the 1.3 series. |
@kratsg - I've been triaging a few pickle bugs, but unfortunately I've not been able to test your code as it isn't a self contained example (imports and data needed). As a result, I will try to fix a few of the issues highlighted, but I may miss some of those that you are seeing. If you have some data and the necessary imports, please would you be willing to update the issue report with the necessaries? Thanks, |
@pelson , you should be able to do something like:
which is self-contained. |
Great! Thanks for the quick response. My PR (#3627) appears to have fixed the problem without the grid, but the following will still fail:
I'll take a look at this and add it to the PR. Thanks. |
For the record, I diagnosed the problem by calling The result:
Next step is to look for where |
Pickling can be quite a pain. ;) I've had to write some of my own custom pickle handlers for various cython code I'm working on. This looks great, albeit slightly convoluted. |
@pelson: aside from the mention of Several other of the most common packages have started allowing an override of |
Hmmm. Might be a good idea - mpl makes fairly regular use of instancemethods as attributes to be called at draw time, so automatic pickling of those would be quite pleasant. The mpl codebase has needed a fair amount of custom getstate/setstate overrides in order to deal with those cases and a few other niceties (e.g. https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/figure.py#L1299). |
Couple of issues I've found.
As it is, the code gives the following error:
If I exclude the label formatter function in the
colorbar
, I get an error ofHow can one pickle?
The text was updated successfully, but these errors were encountered: