From 72d20b065890911a5de677e4df33dcaa2e465677 Mon Sep 17 00:00:00 2001 From: ImportanceOfBeingErnest Date: Sun, 8 Apr 2018 00:27:27 +0200 Subject: [PATCH 1/2] document labelvisibility on shared axes change --- doc/api/api_changes.rst | 10 +++++++++ doc/users/prev_whats_new/whats_new_2.1.0.rst | 10 +++++++++ lib/matplotlib/figure.py | 22 ++++++++++---------- lib/matplotlib/pyplot.py | 11 +++++----- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 730906262c23..c8c229fd32d7 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -407,6 +407,16 @@ 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, :func:`~matplotlib.axis.Axis.set_tick_params` 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, `set_tick_params` +needs to be used, e.g. `ax.xaxis.set_tick_params(labelbottom=True)`. + + Removal of warning on empty legends ----------------------------------- diff --git a/doc/users/prev_whats_new/whats_new_2.1.0.rst b/doc/users/prev_whats_new/whats_new_2.1.0.rst index ff7260d07c91..bbb8cddc0ec3 100644 --- a/doc/users/prev_whats_new/whats_new_2.1.0.rst +++ b/doc/users/prev_whats_new/whats_new_2.1.0.rst @@ -403,6 +403,16 @@ keyword. ax.xaxis.set_tick_params(which='both', rotation=90) +Ticklabels are turned off instead of being invisible +---------------------------------------------------- + +Internally, :func:`~matplotlib.axis.Axis.set_tick_params` 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, `set_tick_params` +needs to be used, e.g. `ax.xaxis.set_tick_params(labelbottom=True)`. + + Shading in 3D bar plots ----------------------- diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 9e6980b007e6..f767c2dce87d 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -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.axis.Axis.set_tick_params`. - squeeze : bool, default: True - - If True, extra dimensions are squeezed out from the returned - axis object: + squeeze : bool, optional, default: True + - If True, extra dimensions are squeezed out from the returned Axes + object: - 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 diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 3afaff8a03eb..93a9979b6e96 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1012,9 +1012,10 @@ 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.axis.Axis.set_tick_params`. squeeze : bool, optional, default: True - If True, extra dimensions are squeezed out from the returned Axes @@ -1022,9 +1023,9 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, - 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 From 89779532dad71132613a760ecc4e536800d259fa Mon Sep 17 00:00:00 2001 From: ImportanceOfBeingErnest Date: Sun, 8 Apr 2018 03:01:07 +0200 Subject: [PATCH 2/2] document labelvisibility on shared axes change (rev1) --- doc/api/api_changes.rst | 14 ++++++++++---- doc/users/prev_whats_new/whats_new_2.1.0.rst | 18 ++++++++++++------ lib/matplotlib/figure.py | 6 +++--- lib/matplotlib/pyplot.py | 6 +++--- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index c8c229fd32d7..4b83c9660788 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -410,11 +410,17 @@ direction) is visible, to avoid making irreversible changes to the figure. Ticklabels are turned off instead of being invisible ---------------------------------------------------- -Internally, :func:`~matplotlib.axis.Axis.set_tick_params` is now used to -hide tick labels instead of setting the visibility on the tick label objects. +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, `set_tick_params` -needs to be used, e.g. `ax.xaxis.set_tick_params(labelbottom=True)`. +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 diff --git a/doc/users/prev_whats_new/whats_new_2.1.0.rst b/doc/users/prev_whats_new/whats_new_2.1.0.rst index bbb8cddc0ec3..171dc7291a9f 100644 --- a/doc/users/prev_whats_new/whats_new_2.1.0.rst +++ b/doc/users/prev_whats_new/whats_new_2.1.0.rst @@ -395,22 +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, :func:`~matplotlib.axis.Axis.set_tick_params` is now used to -hide tick labels instead of setting the visibility on the tick label objects. +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, `set_tick_params` -needs to be used, e.g. `ax.xaxis.set_tick_params(labelbottom=True)`. +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 diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index f767c2dce87d..dbc831ee7c00 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1268,11 +1268,11 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False, 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.axis.Axis.set_tick_params`. + 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. diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 93a9979b6e96..01dea0733b9d 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1015,11 +1015,11 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, 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.axis.Axis.set_tick_params`. + 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. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy