-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/colorbar
Milestone
Description
#13171 documented how to construct a colorbar "without an associated artist", via fig.colorbar(cm.ScalarMappable(norm=norm, cmap=cmap), ax=ax)
. It is also possible e.g. to update the colorbar via
sm = ScalarMappable(norm=norm, cmap=cmap)
fig.colorbar(sm)
<...>
sm.set_cmap("plasma")
(Although this is only documented in master, the recipe has existed for a while.)
But this got broken by #13234: one now gets
Traceback (most recent call last):
File "lib/matplotlib/cbook/__init__.py", line 214, in process
func(*args, **kwargs)
File "lib/matplotlib/colorbar.py", line 1189, in on_mappable_changed
self.update_normal(mappable)
File "lib/matplotlib/colorbar.py", line 1230, in update_normal
self.set_alpha(mappable.get_alpha())
AttributeError: 'ScalarMappable' object has no attribute 'get_alpha'
Indeed, the ScalarMappable class does not define get_alpha(). I think the solutions are either to make Colorbar.update_normal first check for whether such a method exists, or to add a dummy get_alpha() (always returning 1) to ScalarMappable.
Allowing myself to label as release critical (as a regression) but feel free to relabel if you disagree.
mpl master, arch linux, py3.7
Metadata
Metadata
Assignees
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/colorbar