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

Skip to content

Commit 7058cd8

Browse files
committed
Expire colorbar-related deprecations.
1 parent 1708956 commit 7058cd8

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__.
@@ -1587,36 +1577,3 @@ def make_axes_gridspec(parent, *, location=None, orientation=None,
15871577
aspect=aspect0,
15881578
pad=pad)
15891579
return cax, kwargs
1590-
1591-
1592-
@_api.deprecated("3.4", alternative="Colorbar")
1593-
class ColorbarPatch(Colorbar):
1594-
pass
1595-
1596-
1597-
@_api.deprecated("3.4", alternative="Colorbar")
1598-
def colorbar_factory(cax, mappable, **kwargs):
1599-
"""
1600-
Create a colorbar on the given axes for the given mappable.
1601-
1602-
.. note::
1603-
This is a low-level function to turn an existing axes into a colorbar
1604-
axes. Typically, you'll want to use `~.Figure.colorbar` instead, which
1605-
automatically handles creation and placement of a suitable axes as
1606-
well.
1607-
1608-
Parameters
1609-
----------
1610-
cax : `~matplotlib.axes.Axes`
1611-
The `~.axes.Axes` to turn into a colorbar.
1612-
mappable : `~matplotlib.cm.ScalarMappable`
1613-
The mappable to be described by the colorbar.
1614-
**kwargs
1615-
Keyword arguments are passed to the respective colorbar class.
1616-
1617-
Returns
1618-
-------
1619-
`.Colorbar`
1620-
The created colorbar instance.
1621-
"""
1622-
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)