diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index cbb49a94a999..445952f51847 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1737,13 +1737,13 @@ def set_cmap(cmap): ''' cmap = cm.get_cmap(cmap) + # set the default colormap rc('image', cmap=cmap.name) + + # apply to current image if any im = gci() - if im is not None: im.set_cmap(cmap) - else: - raise RuntimeError('You must first define an image, eg with imshow') draw_if_interactive()