@header@
 
 
matplotlib.ticker
index
/usr/local/lib/python2.3/site-packages/matplotlib/ticker.py

Tick locating and formatting
============================
 
This module contains classes to support completely configurable tick
locating and formatting.  Although the locators know nothing about
major or minor ticks, they are used by the Axis class to support major
and minor tick locating and formatting.  Generic tick locators and
formatters are provided, as well as domain specific custom ones..
 
 
Tick locating
-------------
 
The Locator class is the base class for all tick locators.  The
locators handle autoscaling of the view limits based on the data
limits, and the choosing of tick locations.  The most generally useful
tick locator is MultipleLocator.  You initialize this with a base, eg
10, and it picks axis limits and ticks that are multiples of your
base.  The class AutoLocator contains a MultipleLocator instance, and
dynamically updates it based upon the data and zoom limits.  This
should provide much more intelligent automatic tick locations both in
figure creation and in navigation than in prior versions of
matplotlib.
 
The basic generic  locators are
 
  * NullLocator     - No ticks
  
  * FixedLocator    - Tick locations are fixed
 
  * IndexLocator    - locator for index plots (eg where x = range(len(y))
  
  * LinearLocator   - evenly spaced ticks from min to max
 
  * LogLocator      - logarithmically ticks from min to max
 
  * MultipleLocator - ticks and range are a multiple of base;
                      either integer or float
  
  * AutoLocator     - choose a MultipleLocator and dyamically reassign
                      it for intelligent ticking during navigation
  
There are a number of locators specialized for date locations - see
the dates module
 
You can define your own locator by deriving from Locator.  You must
override the __call__ method, which returns a sequence of locations,
and you will probably want to override the autoscale method to set the
view limits from the data limits.
 
If you want to override the default locator, use one of the above or a
custom locator and pass it to the x or y axis instance.  The relevant
methods are::
 
  ax.xaxis.set_major_locator( xmajorLocator )
  ax.xaxis.set_minor_locator( xminorLocator )
  ax.yaxis.set_major_locator( ymajorLocator )
  ax.yaxis.set_minor_locator( yminorLocator )
 
The default minor locator is the NullLocator, eg no minor ticks on by
default.  
 
Tick formatting
---------------
 
Tick formatting is controlled by classes derived from Formatter.  The
formatter operates on a single tick value and returns a string to the
axis.
 
  * NullFormatter      - no labels on the ticks
 
  * FixedFormatter     - set the strings manually for the labels
 
  * FuncFormatter      - user defined function sets the labels
 
  * FormatStrFormatter - use a sprintf format string
  
  * ScalarFormatter    - default formatter for scalars; autopick the fmt string
 
  * LogFormatter       - formatter for log axes
 
 
You can derive your own formatter from the Formatter base class by
simply overriding the __call__ method.  The formatter class has access
to the axis view and data limits.
 
To control the major and minor tick label formats, use one of the
following methods::
 
  ax.xaxis.set_major_formatter( xmajorFormatter )
  ax.xaxis.set_minor_formatter( xminorFormatter )
  ax.yaxis.set_major_formatter( ymajorFormatter )
  ax.yaxis.set_minor_formatter( yminorFormatter )
 
See examples/major_minor_demo1.py for an example of setting major an
minor ticks.  See the matplotlib.dates module for more information and
examples of using date locators and formatters.
 
DEVELOPERS NOTE
 
If you are implementing your own class or modifying one of these, it
is critical that you use viewlim and dataInterval READ ONLY MODE so
multiple axes can share the same locator w/o side effects!

 
Modules
       
math
os
re
sys
time
warnings

 
Classes
       
Base
TickHelper
Formatter
FixedFormatter
FormatStrFormatter
FuncFormatter
NullFormatter
ScalarFormatter
LogFormatter
LogFormatterExponent
LogFormatterMathtext
Locator
AutoLocator
FixedLocator
IndexLocator
LinearLocator
LogLocator
MultipleLocator
NullLocator

 
class AutoLocator(Locator)
    On autoscale this class picks the best MultipleLocator to set the
view limits and the tick locs.
 
 
Method resolution order:
AutoLocator
Locator
TickHelper

Methods defined here:
__call__(self)
Return the locations of the ticks
__init__(self)
autoscale(self)
Try to choose the view limits intelligently
get_locator(self, d)
pick the best locator based on a distance
refresh(self)
refresh internal information based on current lim

Methods inherited from Locator:
nonsingular(self, vmin, vmax)
pan(self, numsteps)
Pan numticks (can be positive or negative)
zoom(self, direction)
Zoom in/out on axis; if direction is >0 zoom in, else zoom out

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class Base
    this solution has some hacks to deal with floating point inaccuracies
 
  Methods defined here:
__init__(self, base)
ge(self, x)
return the largest multiple of base >= x
get_base(self)
gt(self, x)
return the largest multiple of base > x
le(self, x)
return the largest multiple of base <= x
lt(self, x)
return the largest multiple of base < x

 
class FixedFormatter(Formatter)
    Return fixed strings for tick labels
 
 
Method resolution order:
FixedFormatter
Formatter
TickHelper

Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos
__init__(self, seq)
seq is a sequence of strings.  For positions i<len(seq) return
seq[i] regardless of x.  Otherwise return ''

Methods inherited from Formatter:
set_locs(self, locs)

Data and other attributes inherited from Formatter:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class FixedLocator(Locator)
    Tick locations are fixed
 
 
Method resolution order:
FixedLocator
Locator
TickHelper

Methods defined here:
__call__(self)
Return the locations of the ticks
__init__(self, locs)

Methods inherited from Locator:
autoscale(self)
autoscale the view limits
nonsingular(self, vmin, vmax)
pan(self, numsteps)
Pan numticks (can be positive or negative)
refresh(self)
refresh internal information based on current lim
zoom(self, direction)
Zoom in/out on axis; if direction is >0 zoom in, else zoom out

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class FormatStrFormatter(Formatter)
    Use a format string to format the tick
 
 
Method resolution order:
FormatStrFormatter
Formatter
TickHelper

Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos
__init__(self, fmt)

Methods inherited from Formatter:
set_locs(self, locs)

Data and other attributes inherited from Formatter:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class Formatter(TickHelper)
    Convert the tick location to a string
 
  Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos
set_locs(self, locs)

Data and other attributes defined here:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class FuncFormatter(Formatter)
    User defined function for formatting
 
 
Method resolution order:
FuncFormatter
Formatter
TickHelper

Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos
__init__(self, func)

Methods inherited from Formatter:
set_locs(self, locs)

Data and other attributes inherited from Formatter:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class IndexLocator(Locator)
    Place a tick on every multiple of some base number of points
plotted, eg on every 5th point.  It is assumed that you are doing
index plotting; ie the axis is 0, len(data).  This is mainly
useful for x ticks.
 
 
Method resolution order:
IndexLocator
Locator
TickHelper

Methods defined here:
__call__(self)
Return the locations of the ticks
__init__(self, base, offset)
place ticks on the i-th data points where (i-offset)%base==0

Methods inherited from Locator:
autoscale(self)
autoscale the view limits
nonsingular(self, vmin, vmax)
pan(self, numsteps)
Pan numticks (can be positive or negative)
refresh(self)
refresh internal information based on current lim
zoom(self, direction)
Zoom in/out on axis; if direction is >0 zoom in, else zoom out

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class LinearLocator(Locator)
    Determine the tick locations
 
The first time this function is called it will try and set the
number of ticks to make a nice tick partitioning.  Thereafter the
number of ticks will be fixed so that interactive navigation will
be nice
 
 
Method resolution order:
LinearLocator
Locator
TickHelper

Methods defined here:
__call__(self)
Return the locations of the ticks
__init__(self, numticks=None, presets=None)
Use presets to set locs based on lom.  A dict mapping vmin, vmax->locs
autoscale(self)
Try to choose the view limits intelligently

Methods inherited from Locator:
nonsingular(self, vmin, vmax)
pan(self, numsteps)
Pan numticks (can be positive or negative)
refresh(self)
refresh internal information based on current lim
zoom(self, direction)
Zoom in/out on axis; if direction is >0 zoom in, else zoom out

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class Locator(TickHelper)
    Determine the tick locations
 
  Methods defined here:
__call__(self)
Return the locations of the ticks
autoscale(self)
autoscale the view limits
nonsingular(self, vmin, vmax)
pan(self, numsteps)
Pan numticks (can be positive or negative)
refresh(self)
refresh internal information based on current lim
zoom(self, direction)
Zoom in/out on axis; if direction is >0 zoom in, else zoom out

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class LogFormatter(ScalarFormatter)
    Format values for log axis; 
 
if attribute decadeOnly is True, only the decades will be labelled.
 
 
Method resolution order:
LogFormatter
ScalarFormatter
Formatter
TickHelper

Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos
__init__(self, base=10.0, labelOnlyBase=True)
base is used to locate the decade tick, 
which will be the only one to be labeled if labelOnlyBase
is False
base(self, base)
change the base for labeling - warning: should always match the base used for LogLocator
is_decade(self, x)
label_minor(self, labelOnlyBase)
switch on/off minor ticks labeling
nearest_long(self, x)

Methods inherited from ScalarFormatter:
pprint_val(self, x, d)

Methods inherited from Formatter:
set_locs(self, locs)

Data and other attributes inherited from Formatter:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class LogFormatterExponent(LogFormatter)
    Format values for log axis; using exponent = log_base(value)
 
 
Method resolution order:
LogFormatterExponent
LogFormatter
ScalarFormatter
Formatter
TickHelper

Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos

Methods inherited from LogFormatter:
__init__(self, base=10.0, labelOnlyBase=True)
base is used to locate the decade tick, 
which will be the only one to be labeled if labelOnlyBase
is False
base(self, base)
change the base for labeling - warning: should always match the base used for LogLocator
is_decade(self, x)
label_minor(self, labelOnlyBase)
switch on/off minor ticks labeling
nearest_long(self, x)

Methods inherited from ScalarFormatter:
pprint_val(self, x, d)

Methods inherited from Formatter:
set_locs(self, locs)

Data and other attributes inherited from Formatter:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class LogFormatterMathtext(LogFormatter)
    Format values for log axis; using exponent = log_base(value)
 
 
Method resolution order:
LogFormatterMathtext
LogFormatter
ScalarFormatter
Formatter
TickHelper

Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos

Methods inherited from LogFormatter:
__init__(self, base=10.0, labelOnlyBase=True)
base is used to locate the decade tick, 
which will be the only one to be labeled if labelOnlyBase
is False
base(self, base)
change the base for labeling - warning: should always match the base used for LogLocator
is_decade(self, x)
label_minor(self, labelOnlyBase)
switch on/off minor ticks labeling
nearest_long(self, x)

Methods inherited from ScalarFormatter:
pprint_val(self, x, d)

Methods inherited from Formatter:
set_locs(self, locs)

Data and other attributes inherited from Formatter:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class LogLocator(Locator)
    Determine the tick locations for log axes
 
 
Method resolution order:
LogLocator
Locator
TickHelper

Methods defined here:
__call__(self)
Return the locations of the ticks
__init__(self, base=10.0, subs=[1.0])
place ticks on the location= base**i*subs[j]
autoscale(self)
Try to choose the view limits intelligently
base(self, base)
set the base of the log scaling (major tick every base**i, i interger)
subs(self, subs)
set the minor ticks the log scaling every base**i*subs[j]

Methods inherited from Locator:
nonsingular(self, vmin, vmax)
pan(self, numsteps)
Pan numticks (can be positive or negative)
refresh(self)
refresh internal information based on current lim
zoom(self, direction)
Zoom in/out on axis; if direction is >0 zoom in, else zoom out

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class MultipleLocator(Locator)
    Set a tick on every integer that is multiple of base in the
viewInterval
 
 
Method resolution order:
MultipleLocator
Locator
TickHelper

Methods defined here:
__call__(self)
Return the locations of the ticks
__init__(self, base=1.0)
autoscale(self)
Set the view limits to the nearest multiples of base that
contain the data

Methods inherited from Locator:
nonsingular(self, vmin, vmax)
pan(self, numsteps)
Pan numticks (can be positive or negative)
refresh(self)
refresh internal information based on current lim
zoom(self, direction)
Zoom in/out on axis; if direction is >0 zoom in, else zoom out

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class NullFormatter(Formatter)
    Always return the empty string
 
 
Method resolution order:
NullFormatter
Formatter
TickHelper

Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos

Methods inherited from Formatter:
set_locs(self, locs)

Data and other attributes inherited from Formatter:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class NullLocator(Locator)
    No ticks
 
 
Method resolution order:
NullLocator
Locator
TickHelper

Methods defined here:
__call__(self)
Return the locations of the ticks

Methods inherited from Locator:
autoscale(self)
autoscale the view limits
nonsingular(self, vmin, vmax)
pan(self, numsteps)
Pan numticks (can be positive or negative)
refresh(self)
refresh internal information based on current lim
zoom(self, direction)
Zoom in/out on axis; if direction is >0 zoom in, else zoom out

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class ScalarFormatter(Formatter)
    Tick location is a plain old number.  If viewInterval is set, the
formatter will use %d, %1.#f or %1.ef as appropriate.  If it is
not set, the formatter will do str conversion
 
 
Method resolution order:
ScalarFormatter
Formatter
TickHelper

Methods defined here:
__call__(self, x, pos=0)
Return the format for tick val x at position pos
pprint_val(self, x, d)

Methods inherited from Formatter:
set_locs(self, locs)

Data and other attributes inherited from Formatter:
locs = None

Methods inherited from TickHelper:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes inherited from TickHelper:
dataInterval = None
viewInterval = None

 
class TickHelper
     Methods defined here:
set_data_interval(self, interval)
set_view_interval(self, interval)
verify_intervals(self)

Data and other attributes defined here:
dataInterval = None
viewInterval = None

 
Functions
       
arange(...)
arange(start, stop=None, step=1, typecode=None)
 
 Just like range() except it returns an array whose type can be
specified by the keyword argument typecode.
array(...)
array(sequence, typecode=None, copy=1, savespace=0) will return a new array formed from the given (potentially nested) sequence with type given by typecode.  If no typecode is given, then the type will be determined as the minimum type required to hold the objects in sequence.  If copy is zero and sequence is already an array, a reference will be returned.  If savespace is nonzero, the new array will maintain its precision in operations.
closeto(x, y)
decade_down(x, base=10)
floor x to the nearest lower decade
decade_up(x, base=10)
ceil x to the nearest higher decade
is_decade(x, base=10)
take(...)
take(a, indices, axis=0).  Selects the elements in indices from array a along the given axis.
zeros(...)
zeros((d1,...,dn),typecode='l',savespace=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.  If savespace is nonzero the array will be a spacesaver array.

 
Data
        Float = 'd'
__all__ = ('TickHelper', 'Formatter', 'FixedFormatter', 'NullFormatter', 'FuncFormatter', 'FormatStrFormatter', 'ScalarFormatter', 'LogFormatter', 'LogFormatterExponent', 'LogFormatterMathtext', 'Locator', 'IndexLocator', 'FixedLocator', 'NullLocator', 'LinearLocator', 'LogLocator', 'AutoLocator', 'MultipleLocator')
division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
log = <ufunc 'log'>
logical_and = <ufunc 'logical_and'>
verbose = <matplotlib.Verbose instance>
@footer@