AutoLocator2

Defined in module: wield.iirrational.utilities.mpl.utils.AutoLocator2

class AutoLocator2[source][github]

Bases: AutoLocator

__init__()[github]

To know the values of the non-public parameters, please have a look to the defaults of ~matplotlib.ticker.MaxNLocator.

Methods

__init__()

To know the values of the non-public parameters, please have a look to the defaults of ~matplotlib.ticker.MaxNLocator.

create_dummy_axis(**kwargs)

nonsingular(v0, v1)

Adjust a range as needed to avoid singularities.

raise_if_exceeds(locs)

Log at WARNING level if locs is longer than Locator.MAXTICKS.

set_axis(axis)

set_params(**kwargs)

Set parameters for this locator.

tick_values(vmin, vmax)

Return the values of the located ticks given vmin and vmax.

view_limits(dmin, dmax)

Select a scale for the range from vmin to vmax.

Attributes

tick_values(vmin, vmax)[source][github]

Return the values of the located ticks given vmin and vmax.

Note

To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:

>>> print(type(loc))
<type 'Locator'>
>>> print(loc())
[1, 2, 3, 4]
MAXTICKS = 1000[github]
axis = None[github]
create_dummy_axis(**kwargs)[github]
default_params = {'integer': False, 'min_n_ticks': 2, 'nbins': 10, 'prune': None, 'steps': None, 'symmetric': False}[github]
nonsingular(v0, v1)[github]

Adjust a range as needed to avoid singularities.

This method gets called during autoscaling, with (v0, v1) set to the data limits on the Axes if the Axes contains any data, or (-inf, +inf) if not.

  • If v0 == v1 (possibly up to some floating point slop), this method returns an expanded interval around this value.

  • If (v0, v1) == (-inf, +inf), this method returns appropriate default view limits.

  • Otherwise, (v0, v1) is returned without modification.

raise_if_exceeds(locs)[github]

Log at WARNING level if locs is longer than Locator.MAXTICKS.

This is intended to be called immediately before returning locs from __call__ to inform users in case their Locator returns a huge number of ticks, causing Matplotlib to run out of memory.

The “strange” name of this method dates back to when it would raise an exception instead of emitting a log.

set_axis(axis)[github]
set_params(**kwargs)[github]

Set parameters for this locator.

Parameters:
  • nbins (int or 'auto', optional) – see .MaxNLocator

  • steps (array-like, optional) – see .MaxNLocator

  • integer (bool, optional) – see .MaxNLocator

  • symmetric (bool, optional) – see .MaxNLocator

  • prune ({'lower', 'upper', 'both', None}, optional) – see .MaxNLocator

  • min_n_ticks (int, optional) – see .MaxNLocator

view_limits(dmin, dmax)[github]

Select a scale for the range from vmin to vmax.

Subclasses should override this method to change locator behaviour.