@@ -274,6 +274,12 @@ def get_offset(self):
274
274
return ''
275
275
276
276
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
+ """
277
283
self .locs = locs
278
284
279
285
@staticmethod
@@ -496,14 +502,13 @@ class ScalarFormatter(Formatter):
496
502
"""
497
503
Format tick values as a number.
498
504
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
501
506
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`.
506
510
"""
511
+
507
512
def __init__ (self , useOffset = None , useMathText = None , useLocale = None ):
508
513
# useOffset allows plotting small data ranges with large offsets: for
509
514
# 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):
618
623
"%-12g" % value ))
619
624
620
625
def format_data (self , value ):
621
- """
622
- Return a formatted string representation of a number.
623
- """
626
+ # docstring inherited
624
627
if self ._useLocale :
625
628
s = locale .format_string ('%1.10e' , (value ,))
626
629
else :
@@ -657,9 +660,7 @@ def get_offset(self):
657
660
return self .fix_minus (s )
658
661
659
662
def set_locs (self , locs ):
660
- """
661
- Set the locations of the ticks.
662
- """
663
+ # docstring inherited
663
664
self .locs = locs
664
665
if len (self .locs ) > 0 :
665
666
if self ._useOffset :
0 commit comments