10000 Merge pull request #10981 from ImportanceOfBeingErnest/doc-labelvisib… · matplotlib/matplotlib@0984694 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0984694

Browse files
authored
Merge pull request #10981 from ImportanceOfBeingErnest/doc-labelvisibility-on-shared-axes
Document change of label visibility on shared axes
2 parents 634640f + 8977953 commit 0984694

File tree

4 files changed

+52
-19
lines changed

4 files changed

+52
-19
lines changed

doc/api/api_changes.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,22 @@ 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, the `Tick`'s :func:`~matplotlib.axis.Tick.label1On` attribute
414+
is now used to hide tick labels instead of setting the visibility on the tick
415+
label objects.
416+
This improves overall performance and fixes some issues.
417+
As a consequence, in case those labels ought to be shown,
418+
:func:`~matplotlib.axes.Axes.tick_params`
419+
needs to be used, e.g.
420+
421+
::
422+
423+
ax.tick_params(labelbottom=True)
424+
425+
410426
Removal of warning on empty legends
411427
-----------------------------------
412428

doc/users/prev_whats_new/whats_new_2.1.0.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,28 @@ cases.
395395
---------------------------------------------------
396396

397397
Bulk setting of tick label rotation is now possible via
398-
:func:`~matplotlib.axis.Axis.set_tick_params` using the ``rotation``
398+
:func:`~matplotlib.axes.Axes.tick_params` using the ``rotation``
399399
keyword.
400400

401401
::
402402

403-
ax.xaxis.set_tick_params(which='both', rotation=90)
403+
ax.tick_params(which='both', rotation=90)
404+
405+
406+
Ticklabels are turned off instead of being invisible
407+
----------------------------------------------------
408+
409+
Internally, the `Tick`'s :func:`~matplotlib.axis.Tick.label1On` attribute
410+
is now used to hide tick labels instead of setting the visibility on the tick
411+
label objects.
412+
This improves overall performance and fixes some issues.
413+
As a consequence, in case those labels ought to be shown,
414+
:func:`~matplotlib.axes.Axes.tick_params`
415+
needs to be used, e.g.
416+
417+
::
418+
419+
ax.tick_params(labelbottom=True)
404420

405421

406422
Shading in 3D bar plots

lib/matplotlib/figure.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,21 +1262,21 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
12621262
- 'col': each subplot column will share an x- or y-axis.
12631263
12641264
When subplots have a shared x-axis along a column, only the x tick
1265-
labels of the bottom subplot are visible. Similarly, when
1266-
subplots have a shared y-axis along a row, only the y tick labels
1267-
of the first column subplot are visible.
1265+
labels of the bottom subplot are created. Similarly, when subplots
1266+
have a shared y-axis along a row, only the y tick labels of the
1267+
first column subplot are created. To later turn other subplots'
1268+
ticklabels on, use :meth:`~matplotlib.axes.Axes.tick_params`.
12681269
1269-
squeeze : bool, default: True
1270+
squeeze : bool, optional, default: True
12701271
- If True, extra dimensions are squeezed out from the returned
1271-
axis object:
1272+
array of Axes:
12721273
12731274
- if only one subplot is constructed (nrows=ncols=1), the
12741275
resulting single Axes object is returned as a scalar.
1275-
- for Nx1 or 1xN subplots, the returned object is a 1D numpy
1276-
object array of Axes objects are returned as numpy 1D
1277-
arrays.
1278-
- for NxM, subplots with N>1 and M>1 are returned as a 2D
1279-
arrays.
1276+
- for Nx1 or 1xM subplots, the returned object is a 1D numpy
1277+
object array of Axes objects.
1278+
- for NxM, subplots with N>1 and M>1 are returned
1279+
as a 2D array.
12801280
12811281
- If False, no squeezing at all is done: the returned Axes object
12821282
is always a 2D array containing Axes instances, even if it ends

lib/matplotlib/pyplot.py

Lines changed: 8 additions & 7 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.axes.Axes.tick_params`.
10181019
10191020
squeeze : bool, optional, default: True
1020-
- If True, extra dimensions are squeezed out from the returned Axes
1021-
object:
1021+
- If True, extra dimensions are squeezed out from the returned
1022+
array of Axes:
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)
0