Skip to content

Commit d8de9d5

Browse files
committed
Merge pull request matplotlib#3168 from tacaswell/offset_doc
DOC : add prominent doc about set_useOffset
2 parents d27d36c + 78120ef commit d8de9d5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

doc/faq/howto_faq.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ You can also filter on class instances::
3939
o.set_fontstyle('italic')
4040

4141

42+
.. _howto-supress_offset:
43+
How to prevent ticklabels from having an offset
44+
-----------------------------------------------
45+
The default formatter will use an offset to reduce
46+
the length of the ticklabels. To turn this feature
47+
off::
48+
ax.get_xaxis().get_major_formatter().set_useOffset(False)
49+
50+
or use a different formatter. See :mod:`~matplotlib.ticker`
51+
for details.
52+
4253
.. _howto-transparent:
4354

4455
Save transparent figures

lib/matplotlib/ticker.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,25 @@
99
as well as domain specific custom ones..
1010
1111
12+
Default Formatter
13+
-----------------
14+
15+
The default formatter identifies when the x-data being
16+
plotted is a small range on top of a large off set. To
17+
reduce the chances that the ticklabels overlap the ticks
18+
are labeled as deltas from a fixed offset. For example::
19+
20+
ax.plot(np.arange(2000, 2010), range(10))
21+
22+
will have tick of 0-9 with an offset of +2e3. If this
23+
is not desired turn off the use of the offset on the default
24+
formatter::
25+
26+
27+
ax.get_xaxis().get_major_formatter().set_useOffset(False)
28+
29+
or set a different formatter.
30+
1231
Tick locating
1332
-------------
1433

0 commit comments

Comments
 (0)