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 da58453

Browse filesBrowse files
authored
Merge pull request #12767 from anntzer/scalarmappable-default-array
Make colorbars constructible with dataless ScalarMappables.
2 parents 2b634d9 + 961742c commit da58453
Copy full SHA for da58453

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed

‎lib/matplotlib/colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colorbar.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,8 @@ class Colorbar(ColorbarBase):
10691069
def __init__(self, ax, mappable, **kw):
10701070
# Ensure the given mappable's norm has appropriate vmin and vmax set
10711071
# even if mappable.draw has not yet been called.
1072-
mappable.autoscale_None()
1072+
if mappable.get_array() is not None:
1073+
mappable.autoscale_None()
10731074

10741075
self.mappable = mappable
10751076
kw['cmap'] = cmap = mappable.cmap

0 commit comments

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