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

Skip to content

Commit 4bde473

Browse files
committed
Remove deprecated toolkit colorbar implementation.
1 parent fe4fcac commit 4bde473

File tree

13 files changed

+21
-874
lines changed

13 files changed

+21
-874
lines changed

doc/api/next_api_changes/removals/18747-ES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ method now always uses the renderer instance cached on the `.Figure`.
4747

4848
``axes_grid1``
4949
~~~~~~~~~~~~~~
50+
The ``mpl_toolkits.axes_grid1.colorbar`` module and its colorbar implementation
51+
have been removed in favor of :mod:`matplotlib.colorbar`. Additionally:
52+
5053
- The *locator* parameter to ``colorbar()`` has been removed in favor of its
5154
synonym *ticks* (which already existed previously, and is consistent with
5255
:mod:`matplotlib.colorbar`).
56+
- The ``mpl_toolkits.legacy_colorbar`` rcParam has no effect and also has been
57+
removed.

doc/api/toolkits/axes_grid1.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ See :ref:`axes_grid1_users-guide-index` for a guide on the usage of axes_grid1.
2929
axes_grid1.axes_grid
3030
axes_grid1.axes_rgb
3131
axes_grid1.axes_size
32-
axes_grid1.colorbar
3332
axes_grid1.inset_locator
3433
axes_grid1.mpl_axes
3534
axes_grid1.parasite_axes

examples/axes_grid1/demo_axes_grid.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
from mpl_toolkits.axes_grid1 import ImageGrid
1212

1313

14-
plt.rcParams["mpl_toolkits.legacy_colorbar"] = False
15-
16-
1714
def get_demo_image():
1815
z = cbook.get_sample_data("axes_grid/bivariate_normal.npy", np_load=True)
1916
# z is a numpy array of 15x15

examples/axes_grid1/demo_axes_grid2.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
from mpl_toolkits.axes_grid1 import ImageGrid
1414

1515

16-
plt.rcParams["mpl_toolkits.legacy_colorbar"] = False
17-
18-
1916
def add_inner_title(ax, title, loc, **kwargs):
2017
from matplotlib.offsetbox import AnchoredText
2118
from matplotlib.patheffects import withStroke

examples/axes_grid1/demo_edge_colorbar.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
from mpl_toolkits.axes_grid1 import AxesGrid
1313

1414

15-
plt.rcParams["mpl_toolkits.legacy_colorbar"] = False
16-
17-
1815
def get_demo_image():
1916
z = cbook.get_sample_data("axes_grid/bivariate_normal.npy", np_load=True)
2017
# z is a numpy array of 15x15

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ def gen_candidates():
564564
# rcParams deprecated; some can manually be mapped to another key.
565565
# Values are tuples of (version, new_name_or_None).
566566
_deprecated_ignore_map = {
567+
'mpl_toolkits.legacy_colorbar': ('3.4', None),
567568
}
568569

569570
# rcParams deprecated; can use None to suppress warnings; remain actually

lib/matplotlib/rcsetup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,8 +1443,6 @@ def _convert_validator_spec(key, conv):
14431443
# Additional arguments for convert movie writer (using pipes)
14441444
"animation.convert_args": validate_stringlist,
14451445

1446-
"mpl_toolkits.legacy_colorbar": validate_bool,
1447-
14481446
# Classic (pre 2.0) compatibility mode
14491447
# This is used for things that are hard to make backward compatible
14501448
# with a sane rcParam alone. This does *not* turn on classic mode

lib/mpl_toolkits/axes_grid/colorbar.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55

66
import matplotlib as mpl
7-
from matplotlib import _api, cbook, ticker
7+
from matplotlib import _api, cbook
88
from matplotlib.gridspec import SubplotSpec
99

1010
from .axes_divider import Size, SubplotDivider, Divider
@@ -32,27 +32,10 @@ def colorbar(self, mappable, *, ticks=None, **kwargs):
3232
else:
3333
orientation = "vertical"
3434

35-
if mpl.rcParams["mpl_toolkits.legacy_colorbar"]:
36-
cbook.warn_deprecated(
37-
"3.2", message="Since %(since)s, mpl_toolkits's own colorbar "
38-
"implementation is deprecated; it will be removed "
39-
"%(removal)s. Set the 'mpl_toolkits.legacy_colorbar' rcParam "
40-
"to False to use Matplotlib's default colorbar implementation "
41-
"and suppress this deprecation warning.")
42-
if ticks is None:
43-
ticks = ticker.MaxNLocator(5) # For backcompat.
44-
from .colorbar import Colorbar
45-
cb = Colorbar(
46-
self, mappable, orientation=orientation, ticks=ticks, **kwargs)
47-
self._cbid = mappable.callbacksSM.connect(
48-
'changed', cb.update_normal)
49-
mappable.colorbar = cb
50-
self._locator = cb.cbar_axis.get_major_locator()
51-
else:
52-
cb = mpl.colorbar.Colorbar(
53-
self, mappable, orientation=orientation, ticks=ticks, **kwargs)
54-
self._cbid = mappable.colorbar_cid # deprecated.
55-
self._locator = cb.locator # deprecated.
35+
cb = mpl.colorbar.Colorbar(
36+
self, mappable, orientation=orientation, ticks=ticks, **kwargs)
37+
self._cbid = mappable.colorbar_cid # deprecated in 3.3.
38+
self._locator = cb.locator # deprecated in 3.3.
5639

5740
self._config_axes()
5841
return cb

0 commit comments

Comments
 (0)