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

Commit 5a4c8db

Browse filesBrowse files
committed
MNT: Rename callbacksSM to callbacks
This makes the code more consistent throughout with objects having a `callbacks` attribute, rather than associating a name with them on the end.
1 parent ec126b0 commit 5a4c8db
Copy full SHA for 5a4c8db

File tree

Expand file treeCollapse file tree

6 files changed

+13
-7
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+13
-7
lines changed
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``ScalarMappable.callbacksSM``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
is deprecated. Use ``ScalarMappable.callbacks`` instead.

‎doc/api/next_api_changes/removals/19552-GL.rst

Copy file name to clipboardExpand all lines: doc/api/next_api_changes/removals/19552-GL.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ ScalarMappable update checkers
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
``ScalarMappable.update_dict``, ``ScalarMappable.add_checker()``, and
44
``ScalarMappable.check_update()`` have been removed. A callback can
5-
be registered in ``ScalarMappable.callbacksSM`` to be notified of updates.
5+
be registered in ``ScalarMappable.callbacks`` to be notified of updates.

‎examples/images_contours_and_fields/multi_image.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/multi_image.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def update(changed_image):
4747

4848

4949
for im in images:
50-
im.callbacksSM.connect('changed', update)
50+
im.callbacks.connect('changed', update)
5151

5252
plt.show()
5353

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4923,7 +4923,7 @@ def on_changed(collection):
49234923
vbar.set_cmap(collection.get_cmap())
49244924
vbar.set_clim(collection.get_clim())
49254925

4926-
collection.callbacksSM.connect('changed', on_changed)
4926+
collection.callbacks.connect('changed', on_changed)
49274927

49284928
return collection
49294929

‎lib/matplotlib/cm.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cm.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ def __init__(self, norm=None, cmap=None):
263263
self.set_cmap(cmap) # The Colormap instance of this ScalarMappable.
264264
#: The last colorbar associated with this ScalarMappable. May be None.
265265
self.colorbar = None
266-
self.callbacksSM = cbook.CallbackRegistry()
266+
self.callbacks = cbook.CallbackRegistry()
267+
268+
callbacksSM = _api.deprecated("3.5", alternative="callbacks")(
269+
property(lambda self: self.callbacks))
267270

268271
def _scale_norm(self, norm, vmin, vmax):
269272
"""
@@ -495,5 +498,5 @@ def changed(self):
495498
Call this whenever the mappable is changed to notify all the
496499
callbackSM listeners to the 'changed' signal.
497500
"""
498-
self.callbacksSM.process('changed', self)
501+
self.callbacks.process('changed', self)
499502
self.stale = True

‎lib/matplotlib/colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colorbar.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def __init__(self, ax, mappable=None, *, cmap=None,
404404
alpha = mappable.get_alpha()
405405

406406
mappable.colorbar = self
407-
mappable.colorbar_cid = mappable.callbacksSM.connect(
407+
mappable.colorbar_cid = mappable.callbacks.connect(
408408
'changed', self.update_normal)
409409

410410
_api.check_in_list(
@@ -981,7 +981,7 @@ def remove(self):
981981
"""
982982
self.ax.remove()
983983

984-
self.mappable.callbacksSM.disconnect(self.mappable.colorbar_cid)
984+
self.mappable.callbacks.disconnect(self.mappable.colorbar_cid)
985985
self.mappable.colorbar = None
986986
self.mappable.colorbar_cid = None
987987

0 commit comments

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