8000 Merge pull request #16233 from anntzer/scalarfdoc · matplotlib/matplotlib@a8db0ac · GitHub
[go: up one dir, main page]

Skip to content

Commit a8db0ac

Browse files
authored
Merge pull request #16233 from anntzer/scalarfdoc
Reword ScalarFormatter docstrings.
2 parents 6ee361b + 4adb711 commit a8db0ac

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

lib/matplotlib/ticker.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ def get_offset(self):
274274
return ''
275275

276276
def set_locs(self, locs):
277+
"""
278+
Set the locations of the ticks.
279+
280+
This method is called before computing the tick labels because some
281+
formatters need to know all tick locations to do so.
282+
"""
277283
self.locs = locs
278284

279285
@staticmethod
@@ -496,14 +502,13 @@ class ScalarFormatter(Formatter):
496502
"""
497503
Format tick values as a number.
498504
499-
Tick value is interpreted as a plain old number. If
500-
``useOffset==True`` and the data range is much smaller than the data
505+
If ``useOffset == True`` and the data range is much smaller than the data
501506
average, then an offset will be determined such that the tick labels
502-
are meaningful. Scientific notation is used for ``data < 10^-n`` or
503-
``data >= 10^m``, where ``n`` and ``m`` are the power limits set
504-
using ``set_powerlimits((n, m))``. The defaults for these are
505-
controlled by the ``axes.formatter.limits`` rc parameter.
507+
are meaningful. Scientific notation is used for ``data < 10^-n`` or
508+
``data >= 10^m``, where ``n`` and ``m`` are the power limits set using
509+
``set_powerlimits((n, m))``, defaulting to :rc:`axes.formatter.limits`.
506510
"""
511+
507512
def __init__(self, useOffset=None, useMathText=None, useLocale=None):
508513
# useOffset allows plotting small data ranges with large offsets: for
509514
# example: [1+1e-9, 1+2e-9, 1+3e-9] useMathText will render the offset
@@ -618,9 +623,7 @@ def format_data_short(self, value):
618623
"%-12g" % value))
619624

620625
def format_data(self, value):
621-
"""
622-
Return a formatted string representation of a number.
623-
"""
626+
# docstring inherited
624627
if self._useLocale:
625628
s = locale.format_string('%1.10e', (value,))
626629
else:
@@ -657,9 +660,7 @@ def get_offset(self):
657660
return self.fix_minus(s)
658661

659662
def set_locs(self, locs):
660-
"""
661-
Set the locations of the ticks.
662-
"""
663+
# docstring inherited
663664
self.locs = locs
664665
if len(self.locs) > 0:
665666
if self._useOffset:

0 commit comments

Comments
 (0)
0