From c1b0756547c4bd1a110688ded443dc238e9ab092 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Tue, 24 Nov 2020 23:14:11 -0700 Subject: [PATCH] DOC: Add note about locators at top of ticker docs The note about not sharing `Locator` instances should be more prominent than hiding in the base class docs, which most users have no need to examine. --- lib/matplotlib/ticker.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 1dcbfbc49b08..d740721b6c78 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 ---------------