Skip to content

Document change of label visibility on shared axes #10981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions doc/api/api_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,22 @@ Both bindings are disabled if only a subset of the grid lines (in either
direction) is visible, to avoid making irreversible changes to the figure.


Ticklabels are turned off instead of being invisible
----------------------------------------------------

Internally, the `Tick`'s :func:`~matplotlib.axis.Tick.label1On` attribute
is now used to hide tick labels instead of setting the visibility on the tick
label objects.
This improves overall performance and fixes some issues.
As a consequence, in case those labels ought to be shown,
:func:`~matplotlib.axes.Axes.tick_params`
needs to be used, e.g.

::

ax.tick_params(labelbottom=True)


Removal of warning on empty legends
-----------------------------------

Expand Down
20 changes: 18 additions & 2 deletions doc/users/prev_whats_new/whats_new_2.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,28 @@ cases.
---------------------------------------------------

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

::

ax.xaxis.set_tick_params(which='both', rotation=90)
ax.tick_params(which='both', rotation=90)


Ticklabels are turned off instead of being invisible
----------------------------------------------------

Internally, the `Tick`'s :func:`~matplotlib.axis.Tick.label1On` attribute
is now used to hide tick labels instead of setting the visibility on the tick
label objects.
This improves overall performance and fixes some issues.
As a consequence, in case those labels ought to be shown,
:func:`~matplotlib.axes.Axes.tick_params`
needs to be used, e.g.

::

ax.tick_params(labelbottom=True)


Shading in 3D bar plots
Expand Down
20 changes: 10 additions & 10 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1265,21 +1265,21 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
- 'col': each subplot column will share an x- or y-axis.

When subplots have a shared x-axis along a column, only the x tick
labels of the bottom subplot are visible. Similarly, when
subplots have a shared y-axis along a row, only the y tick labels
of the first column subplot are visible.
labels of the bottom subplot are created. Similarly, when subplots
have a shared y-axis along a row, only the y tick labels of the
first column subplot are created. To later turn other subplots'
ticklabels on, use :meth:`~matplotlib.axes.Axes.tick_params`.

squeeze : bool, default: True
squeeze : bool, optional, default: True
- If True, extra dimensions are squeezed out from the returned
axis object:
array of Axes:

- if only one subplot is constructed (nrows=ncols=1), the
resulting single Axes object is returned as a scalar.
- for Nx1 or 1xN subplots, the returned object is a 1D numpy
object array of Axes objects are returned as numpy 1D
arrays.
- for NxM, subplots with N>1 and M>1 are returned as a 2D
arrays.
- for Nx1 or 1xM subplots, the returned object is a 1D numpy
object array of Axes objects.
- for NxM, subplots with N>1 and M>1 are returned
as a 2D array.

- If False, no squeezing at all is done: the returned Axes object
is always a 2D array containing Axes instances, even if it ends
Expand Down
15 changes: 8 additions & 7 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,19 +1012,20 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
- 'col': each subplot column will share an x- or y-axis.

When subplots have a shared x-axis along a column, only the x tick
labels of the bottom subplot are visible. Similarly, when subplots
labels of the bottom subplot are created. Similarly, when subplots
have a shared y-axis along a row, only the y tick labels of the first
column subplot are visible.
column subplot are created. To later turn other subplots' ticklabels
on, use :meth:`~matplotlib.axes.Axes.tick_params`.

squeeze : bool, optional, default: True
- If True, extra dimensions are squeezed out from the returned Axes
object:
- If True, extra dimensions are squeezed out from the returned
array of Axes:

- if only one subplot is constructed (nrows=ncols=1), the
resulting single Axes object is returned as a scalar.
- for Nx1 or 1xN subplots, the returned object is a 1D numpy
object array of Axes objects are returned as numpy 1D arrays.
- for NxM, subplots with N>1 and M>1 are returned as a 2D arrays.
- for Nx1 or 1xM subplots, the returned object is a 1D numpy
object array of Axes objects.
- for NxM, subplots with N>1 and M>1 are returned as a 2D array.

- If False, no squeezing at all is done: the returned Axes object is
always a 2D array containing Axes instances, even if it ends up
Expand Down