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

Skip to content

Commit 849c5db

Browse files
authored
Merge pull request #22081 from anntzer/cbar36
Expire colorbar-related deprecations.
2 parents 8fa8b81 + 7058cd8 commit 849c5db

File tree

3 files changed

+12
-52
lines changed

3 files changed

+12
-52
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
colorbar defaults to stealing space from the mappable's axes rather than the current axes
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Pass ``ax=plt.gca()`` to restore the previous behavior.
5+
6+
Removal of deprecated ``colorbar`` APIs
7+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
9+
The following deprecated :mod:`.colorbar` APIs have been removed:
10+
``ColorbarPatch`` and ``colorbar_factory`` (use `.Colorbar` instead);
11+
``colorbar_doc``, ``colorbar_kw_doc``, ``make_axes_kw_doc``.

lib/matplotlib/colorbar.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,6 @@
194194
_colormap_kw_doc))
195195

196196

197-
@_api.caching_module_getattr # module-level deprecations
198-
class __getattr__:
199-
colorbar_doc = _api.deprecated("3.4", obj_type="")(property(
200-
lambda self: docstring.interpd.params["colorbar_doc"]))
201-
colorbar_kw_doc = _api.deprecated("3.4", obj_type="")(property(
202-
lambda self: _colormap_kw_doc))
203-
make_axes_kw_doc = _api.deprecated("3.4", obj_type="")(property(
204-
lambda self: _make_axes_param_doc + _make_axes_other_param_doc))
205-
206-
207197
def _set_ticks_on_axis_warn(*args, **kwargs):
208198
# a top level function which gets put in at the axes'
209199
# set_xticks and set_yticks by Colorbar.__init__.
@@ -1591,36 +1581,3 @@ def make_axes_gridspec(parent, *, location=None, orientation=None,
15911581
pad=pad)
15921582

15931583
return cax, kwargs
1594-
1595-
1596-
@_api.deprecated("3.4", alternative="Colorbar")
1597-
class ColorbarPatch(Colorbar):
1598-
pass
1599-
1600-
1601-
@_api.deprecated("3.4", alternative="Colorbar")
1602-
def colorbar_factory(cax, mappable, **kwargs):
1603-
"""
1604-
Create a colorbar on the given axes for the given mappable.
1605-
1606-
.. note::
1607-
This is a low-level function to turn an existing axes into a colorbar
1608-
axes. Typically, you'll want to use `~.Figure.colorbar` instead, which
1609-
automatically handles creation and placement of a suitable axes as
1610-
well.
1611-
1612-
Parameters
1613-
----------
1614-
cax : `~matplotlib.axes.Axes`
1615-
The `~.axes.Axes` to turn into a colorbar.
1616-
mappable : `~matplotlib.cm.ScalarMappable`
1617-
The mappable to be described by the colorbar.
1618-
**kwargs
1619-
Keyword arguments are passed to the respective colorbar class.
1620-
1621-
Returns
1622-
-------
1623-
`.Colorbar`
1624-
The created colorbar instance.
1625-
"""
1626-
return Colorbar(cax, mappable, **kwargs)

lib/matplotlib/figure.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,15 +1129,7 @@ def colorbar(
11291129
self, mappable, cax=None, ax=None, use_gridspec=True, **kwargs):
11301130
"""%(colorbar_doc)s"""
11311131
if ax is None:
1132-
ax = self.gca()
1133-
if (hasattr(mappable, "axes") and ax is not mappable.axes
1134-
and cax is None):
1135-
_api.warn_deprecated(
1136-
"3.4", message="Starting from Matplotlib 3.6, colorbar() "
1137-
"will steal space from the mappable's axes, rather than "
1138-
"from the current axes, to place the colorbar. To "
1139-
"silence this warning, explicitly pass the 'ax' argument "
1140-
"to colorbar().")
1132+
ax = getattr(mappable, "axes", self.gca())
11411133

11421134
# Store the value of gca so that we can set it back later on.
11431135
if cax is None:

0 commit comments

Comments
 (0)