Skip to content

Commit fa96f30

Browse files
committed
Also warn in pyplot.colorbar (by falling back to Figure.colorbar).
1 parent 825c242 commit fa96f30

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Figure.colorbar now warns when the mappable's axes is different from the current axes
2-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1+
``colorbar`` now warns when the mappable's axes is different from the current axes
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33

4-
Currently, `.Figure.colorbar` steals space by default from the current axes
5-
to place the colorbar. In a future version, it will steal space from the
6-
mappable's axes instead. In preparation for this change, `.Figure.colorbar`
7-
now emits a warning when the current axes is not the same as the mappable's
8-
axes.
4+
Currently, `.Figure.colorbar` and `.pyplot.colorbar` steal space by default
5+
from the current axes to place the colorbar. In a future version, they will
6+
steal space from the mappable's axes instead. In preparation for this change,
7+
`.Figure.colorbar` and `.pyplot.colorbar` now emits a warning when the current
8+
axes is not the same as the mappable's axes.

lib/matplotlib/pyplot.py

-2
Original file line numberDiff line numberDiff line change
@@ -2181,8 +2181,6 @@ def colorbar(mappable=None, cax=None, ax=None, **kw):
21812181
'creation. First define a mappable such as '
21822182
'an image (with imshow) or a contour set ('
21832183
'with contourf).')
2184-
if ax is None:
2185-
ax = gca()
21862184
ret = gcf().colorbar(mappable, cax=cax, ax=ax, **kw)
21872185
return ret
21882186

0 commit comments

Comments
 (0)