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

Skip to content

Commit 72d20b0

Browse files
document labelvisibility on shared axes change
1 parent e2a0813 commit 72d20b0

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
lines changed

doc/api/api_changes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ Both bindings are disabled if only a subset of the grid lines (in either
407407
direction) is visible, to avoid making irreversible changes to the figure.
408408

409409

410+
Ticklabels are turned off instead of being invisible
411+
----------------------------------------------------
412+
413+
Internally, :func:`~matplotlib.axis.Axis.set_tick_params` is now used to
414+
hide tick labels instead of setting the visibility on the tick label objects.
415+
This improves overall performance and fixes some issues.
416+
As a consequence, in case those labels ought to be shown, `set_tick_params`
417+
needs to be used, e.g. `ax.xaxis.set_tick_params(labelbottom=True)`.
418+
419+
410420
Removal of warning on empty legends
411421
-----------------------------------
412422

doc/users/prev_whats_new/whats_new_2.1.0.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,16 @@ keyword.
403403
ax.xaxis.set_tick_params(which='both', rotation=90)
404404

405405

406+
Ticklabels are turned off instead of being invisible
407+
----------------------------------------------------
408+
409+
Internally, :func:`~matplotlib.axis.Axis.set_tick_params` is now used to
410+
hide tick labels instead of setting the visibility on the tick label objects.
411+
This improves overall performance and fixes some issues.
412+
As a consequence, in case those labels ought to be shown, `set_tick_params`
413+
needs to be used, e.g. `ax.xaxis.set_tick_params(labelbottom=True)`.
414+
415+
406416
Shading in 3D bar plots
407417
-----------------------
408418

lib/matplotlib/figure.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,21 +1265,21 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
12651265
- 'col': each subplot column will share an x- or y-axis.
12661266
12671267
When subplots have a shared x-axis along a column, only the x tick
1268-
labels of the bottom subplot are visible. Similarly, when
1269-
subplots have a shared y-axis along a row, only the y tick labels
1270-
of the first column subplot are visible.
1268+
labels of the bottom subplot are created. Similarly, when subplots
1269+
have a shared y-axis along a row, only the y tick labels of the
1270+
first column subplot are created. To later turn other subplots'
1271+
ticklabels on, use :meth:`~matplotlib.axis.Axis.set_tick_params`.
12711272
1272-
squeeze : bool, default: True
1273-
- If True, extra dimensions are squeezed out from the returned
1274-
axis object:
1273+
squeeze : bool, optional, default: True
1274+
- If True, extra dimensions are squeezed out from the returned Axes
1275+
object:
12751276
12761277
- if only one subplot is constructed (nrows=ncols=1), the
12771278
resulting single Axes object is returned as a scalar.
1278-
- for Nx1 or 1xN subplots, the returned object is a 1D numpy
1279-
object array of Axes objects are returned as numpy 1D
1280-
arrays.
1281-
- for NxM, subplots with N>1 and M>1 are returned as a 2D
1282-
arrays.
1279+
- for Nx1 or 1xM subplots, the returned object is a 1D numpy
1280+
object array of Axes objects.
1281+
- for NxM, subplots with N>1 and M>1 are returned
1282+
as a 2D array.
12831283
12841284
- If False, no squeezing at all is done: the returned Axes object
12851285
is always a 2D array containing Axes instances, even if it ends

lib/matplotlib/pyplot.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,19 +1012,20 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
10121012
- 'col': each subplot column will share an x- or y-axis.
10131013
10141014
When subplots have a shared x-axis along a column, only the x tick
1015-
labels of the bottom subplot are visible. Similarly, when subplots
1015+
labels of the bottom subplot are created. Similarly, when subplots
10161016
have a shared y-axis along a row, only the y tick labels of the first
1017-
column subplot are visible.
1017+
column subplot are created. To later turn other subplots' ticklabels
1018+
on, use :meth:`~matplotlib.axis.Axis.set_tick_params`.
10181019
10191020
squeeze : bool, optional, default: True
10201021
- If True, extra dimensions are squeezed out from the returned Axes
10211022
object:
10221023
10231024
- if only one subplot is constructed (nrows=ncols=1), the
10241025
resulting single Axes object is returned as a scalar.
1025-
- for Nx1 or 1xN subplots, the returned object is a 1D numpy
1026-
object array of Axes objects are returned as numpy 1D arrays.
1027-
- for NxM, subplots with N>1 and M>1 are returned as a 2D arrays.
1026+
- for Nx1 or 1xM subplots, the returned object is a 1D numpy
1027+
object array of Axes objects.
1028+
- for NxM, subplots with N>1 and M>1 are returned as a 2D array.
10281029
10291030
- If False, no squeezing at all is done: the returned Axes object is
10301031
always a 2D array containing Axes instances, even if it ends up

0 commit comments

Comments
 (0)