2
2
Tick locating and formatting
3
3
============================
4
4
5
- This module contains classes to support completely configurable tick locating
6
- and formatting. Although the locators know nothing about major or minor
7
- ticks, they are used by the Axis class to support major and minor tick
8
- locating and formatting. Generic tick locators and formatters are provided,
9
- as well as domain specific custom ones..
5
+ This module contains classes to support completely configurable tick
6
+ locating and formatting. Although the locators know nothing about major
7
+ or minor ticks, they are used by the Axis class to support major and
8
+ minor tick locating and formatting. Generic tick locators and
9
+ formatters are provided, as well as domain specific custom ones..
10
10
11
11
12
12
Default Formatter
35
35
The Locator class is the base class for all tick locators. The locators
36
36
handle autoscaling of the view limits based on the data limits, and the
37
37
choosing of tick locations. A useful semi-automatic tick locator is
38
- MultipleLocator. You initialize this with a base, e.g., 10, and it picks axis
39
- limits and ticks that are multiples of your base.
38
+ MultipleLocator. You initialize this with a base, e.g., 10, and it
39
+ picks axis limits and ticks that are multiples of your base.
40
40
41
41
The Locator subclasses defined here are
42
42
56
56
logarithmically ticks from min to max
57
57
58
58
:class:`SymmetricalLogLocator`
59
- locator for use with with the symlog norm, works like the `LogLocator` for
60
- the part outside of the threshold and add 0 if inside the limits
59
+ locator for use with with the symlog norm, works like the
60
+ `LogLocator` for the part outside of the threshold and add 0 if
61
+ inside the limits
61
62
62
63
:class:`MultipleLocator`
63
64
ticks and range are a multiple of base;
@@ -788,8 +789,13 @@ def __init__(self, base=10.0, labelOnlyBase=True):
788
789
self .labelOnlyBase = labelOnlyBase
789
790
790
791
def base (self , base ):
791
- """change the *base* for labeling - warning: should always match the
792
- base used for :class:`LogLocator`"""
792
+ """
793
+ change the `base` for labeling.
794
+
795
+ .. warning::
796
+ Should always match the base used for :class:`LogLocator`
797
+
798
+ """
793
799
self ._base = base
794
800
795
801
def label_minor (self , labelOnlyBase ):
@@ -801,7 +807,9 @@ def label_minor(self, labelOnlyBase):
801
807
self .labelOnlyBase = labelOnlyBase
802
808
803
809
def __call__ (self , x , pos = None ):
804
- """Return the format for tick val *x* at position *pos*"""
810
+ """
811
+ Return the format for tick val `x` at position `pos`.
812
+ """
805
813
vmin , vmax = self .axis .get_view_interval ()
806
814
d = abs (vmax - vmin )
807
815
b = self ._base
@@ -832,7 +840,9 @@ def format_data(self, value):
832
840
return value
833
841
834
842
def format_data_short (self , value ):
835
- 'return a short formatted string representation of a number'
843
+ """
844
+ Return a short formatted string representation of a number.
845
+ """
836
846
return '%-12g' % value
837
847
838
848
def pprint_val (self , x , d ):
@@ -870,7 +880,7 @@ def pprint_val(self, x, d):
870
880
871
881
class LogFormatterExponent (LogFormatter ):
872
882
"""
873
- Format values for log axis using ``exponent = log_base(value)``
883
+ Format values for log axis using ``exponent = log_base(value)``.
874
884
"""
875
885
def __call__ (self , x , pos = None ):
876
886
"""
0 commit comments