From 78120efa2418c96629e4ff6d0e6235d38a466397 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 29 Jun 2014 18:38:13 -0400 Subject: [PATCH] DOC : add prominent doc about set_useOffset added text to both ticker.py and FAQ closes #2796 --- doc/faq/howto_faq.rst | 11 +++++++++++ lib/matplotlib/ticker.py | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/doc/faq/howto_faq.rst b/doc/faq/howto_faq.rst index 87be81e33fc9..4ac4c0a89f47 100644 --- a/doc/faq/howto_faq.rst +++ b/doc/faq/howto_faq.rst @@ -39,6 +39,17 @@ You can also filter on class instances:: o.set_fontstyle('italic') +.. _howto-supress_offset: +How to prevent ticklabels from having an offset +----------------------------------------------- +The default formatter will use an offset to reduce +the length of the ticklabels. To turn this feature +off:: + ax.get_xaxis().get_major_formatter().set_useOffset(False) + +or use a different formatter. See :mod:`~matplotlib.ticker` +for details. + .. _howto-transparent: Save transparent figures diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index a33e9eae4bb2..0ed70abc2775 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -9,6 +9,25 @@ as well as domain specific custom ones.. +Default Formatter +----------------- + +The default formatter identifies when the x-data being +plotted is a small range on top of a large off set. To +reduce the chances that the ticklabels overlap the ticks +are labeled as deltas from a fixed offset. For example:: + + ax.plot(np.arange(2000, 2010), range(10)) + +will have tick of 0-9 with an offset of +2e3. If this +is not desired turn off the use of the offset on the default +formatter:: + + + ax.get_xaxis().get_major_formatter().set_useOffset(False) + +or set a different formatter. + Tick locating -------------