Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da58453

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

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/colorbar.py

Lines 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)