We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 346615e + bd5c5b4 commit bdc427aCopy full SHA for bdc427a
lib/matplotlib/pyplot.py
@@ -1682,6 +1682,8 @@ def colormaps():
1682
def colorbar(mappable=None, cax=None, ax=None, **kw):
1683
if mappable is None:
1684
mappable = gci()
1685
+ if mappable is None:
1686
+ raise RuntimeError('You must first define an image, eg with imshow')
1687
if ax is None:
1688
ax = gca()
1689
@@ -1732,6 +1734,9 @@ def set_cmap(cmap):
1732
1734
1733
1735
if im is not None:
1736
im.set_cmap(cmap)
1737
+ else:
1738
1739
+
1740
draw_if_interactive()
1741
1742
0 commit comments