From dd88dfe3c002e7f77c3ddb418269759ad0c858e7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 16 Dec 2020 20:16:11 -0500 Subject: [PATCH] Backport PR #19002: DOC: Add note about locators at top of ticker docs --- lib/matplotlib/ticker.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 67931617423f..749d5d99eaec 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -81,6 +81,19 @@ The default minor locator is `NullLocator`, i.e., no minor ticks on by default. +.. note:: + `Locator` instances should not be used with more than one + `~matplotlib.axis.Axis` or `~matplotlib.axes.Axes`. So instead of:: + + locator = MultipleLocator(5) + ax.xaxis.set_major_locator(locator) + ax2.xaxis.set_major_locator(locator) + + do the following instead:: + + ax.xaxis.set_major_locator(MultipleLocator(5)) + ax2.xaxis.set_major_locator(MultipleLocator(5)) + Tick formatting ---------------