Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

AttributeError (no attribute 'callbacks') when setting attributes on pickle-loaded PatchCollection #6048

Copy link
Copy link
Closed
@jasoncpatton

Description

@jasoncpatton
Issue body actions

Using matplotlib version 1.5.1 installed from pip on Linux (Fedora 22 and CentOS 7).

Trying to set certain attributes (e.g. cmap, clim) on a PatchCollection loaded from a pickle leads to an AttributeError: 'CallbackRegistry' object has no attribute 'callbacks':

Traceback (most recent call last):
  File "mpl_pickle_pc_test.py", line 48, in <module>
    pc_loaded.set_cmap(cmap)
  File "<venv>/lib/python2.7/site-packages/matplotlib/cm.py", line 308, in set_cmap
    self.changed()
  File "<venv>/lib/python2.7/site-packages/matplotlib/cm.py", line 359, in changed
    self.callbacksSM.process('changed', self)
  File "<venv>/lib/python2.7/site-packages/matplotlib/cbook.py", line 560, in process
    if s in self.callbacks:
AttributeError: 'CallbackRegistry' object has no attribute 'callbacks'

I've created a gist to reproduce this behavior: https://gist.github.com/jasoncpatton/c19d19b638ff10ece5d2

Oddly, if you catch the AttributeError and ignore it (set use_try = True in the gist), the attribute is actually set on the PatchCollection. However, using any methods that take the PatchCollection as a parameter (e.g. fig.colorbar()) will also break your code.

This behavior does not occur in version 1.4.3.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.