8000 Make colorbars constructible with dataless ScalarMappables. by anntzer · Pull Request #12767 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/matplotlib/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,8 @@ class Colorbar(ColorbarBase):
def __init__(self, ax, mappable, **kw):
# Ensure the given mappable's norm has appropriate vmin and vmax set
# even if mappable.draw has not yet been called.
mappable.autoscale_None()
if mappable.get_array() is not None:
mappable.autoscale_None()

self.mappable = mappable
kw['cmap'] = cmap = mappable.cmap
Expand Down
0