Pickling imshow fails (?due to _imcache) · Issue #3614 · matplotlib/matplotlib · GitHub
Skip to content

Pickling imshow fails (?due to _imcache) #3614

Description

@mfitzp

Pickling imshow objects (I'm using them used for heatmaps) fails with the following error in IPython after %matplotlib inline magic has been used. If inline figures are not set they work as expected.

UnpickleableError: Cannot pickle <type 'Image'> objects

Using matplotlib.tests.test_pickle.recursive_pickle fails reporting the following (similar to #1719):

Failed to pickle attribute "gridline" in (list/tuple item #0 in (attribute "majorTicks" in (attribute "xaxis" in (list/tuple item #1 in (list/tuple item #1 in (list/tuple item #0 in (attribute "_elements" in (attribute "_axstack" in (top level object))))))))).  Type: <class 'matplotlib.lines.Line2D'>

However, using matplotlib.tests.test_pickle.depth_getter its possible to identify the object that is the cause of the initial error. It's at:

140628613187224 (8, <Image object at 0x7fe6a688c698>, u'attribute "_imcache" in (list/tuple item #0 in (attribute "images" in (list/tuple item #1 in (list/tuple item #1 in (list/tuple item #0 in (attribute "_elements" in (attribute "_axstack" in (top level object))))))))')

It looks as though this is a cache of the rendered image. Can these be ignored when pickling?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions