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;
@@ -790,8 +791,13 @@ def __init__(self, base=10.0, labelOnlyBase=True):
790
791
self .labelOnlyBase = labelOnlyBase
791
792
792
793
def base (self , base ):
793
- """change the *base* for labeling - warning: should always match the
794
- base used for :class:`LogLocator`"""
794
+ """
795
+ change the `base` for labeling.
796
+
797
+ .. warning::
798
+ Should always match the base used for :class:`LogLocator`
799
+
800
+ """
795
801
self ._base = base
796
802
797
803
def label_minor (self , labelOnlyBase ):
@@ -803,7 +809,9 @@ def label_minor(self, labelOnlyBase):
803
809
self .labelOnlyBase = labelOnlyBase
804
810
805
811
def __call__ (self , x , pos = None ):
806
- """Return the format for tick val *x* at position *pos*"""
812
+ """
813
+ Return the format for tick val `x` at position `pos`.
814
+ """
807
815
vmin , vmax = self .axis .get_view_interval ()
808
816
d = abs (vmax - vmin )
809
817
b = self ._base
@@ -834,7 +842,9 @@ def format_data(self, value):
834
842
return value
835
843
836
844
def format_data_short (self , value ):
837
- 'return a short formatted string representation of a number'
845
+ """
846
+ Return a short formatted string representation of a number.
847
+ """
838
848
return '%-12g' % value
839
849
840
850
def pprint_val (self , x , d ):
@@ -872,7 +882,7 @@ def pprint_val(self, x, d):
872
882
873
883
class LogFormatterExponent (LogFormatter ):
874
884
"""
875
- Format values for log axis using ``exponent = log_base(value)``
885
+ Format values for log axis using ``exponent = log_base(value)``.
876
886
"""
877
887
def __call__ (self , x , pos = None ):
878
888
"""
0 commit comments