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

Skip to content

Commit b5f227e

Browse files
authored
Merge pull request matplotlib#25889 from anntzer/utl
Deprecate CbarAxesBase.toggle_label.
2 parents 10e8bf1 + ff8b086 commit b5f227e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``CbarAxesBase.toggle_label``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... is deprecated. Instead, use standard methods for manipulating colorbar
4+
labels (`.Colorbar.set_label`) and tick labels (`.Axes.tick_params`).

galleries/examples/axes_grid1/demo_axes_grid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
im = ax.imshow(Z, extent=extent)
3737
grid.cbar_axes[0].colorbar(im)
3838
for cax in grid.cbar_axes:
39-
cax.toggle_label(False)
39+
cax.tick_params(labeltop=False)
4040
# This affects all axes as share_all = True.
4141
grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2])
4242

@@ -49,7 +49,7 @@
4949
for ax, cax in zip(grid, grid.cbar_axes):
5050
im = ax.imshow(Z, extent=extent)
5151
cax.colorbar(im)
52-
cax.toggle_label(False)
52+
cax.tick_params(labeltop=False)
5353
# This affects all axes as share_all = True.
5454
grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2])
5555

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def colorbar(self, mappable, **kwargs):
2626
return self.figure.colorbar(
2727
mappable, cax=self, location=self.orientation, **kwargs)
2828

29+
@_api.deprecated("3.8", alternative="ax.tick_params and colorbar.set_label")
2930
def toggle_label(self, b):
3031
axis = self.axis[self.orientation]
3132
axis.toggle(ticklabels=b, label=b)

0 commit comments

Comments
 (0)