smpl.plot.LinearLocator

class smpl.plot.LinearLocator(numticks=None, presets=None)[source]

Bases: Locator

Determine the tick locations

The first time this function is called it will try to 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

__init__(numticks=None, presets=None)[source]

Use presets to set locs based on lom. A dict mapping vmin, vmax->locs

Methods

__init__([numticks, presets])

Use presets to set locs based on lom.

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_bounds(vmin, vmax)

[Deprecated]

set_data_interval(vmin, vmax)

[Deprecated]

set_params([numticks, presets])

Set parameters within this locator.

set_view_interval(vmin, vmax)

[Deprecated]

tick_values(vmin, vmax)

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

view_limits(vmin, vmax)

Try to choose the view limits intelligently.

Attributes

MAXTICKS

axis

numticks

nonsingular(v0, v1)

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)

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_bounds(vmin, vmax)

[Deprecated]

Notes

Deprecated since version 3.5: Use .Axis.set_view_interval and .Axis.set_data_interval instead.

set_data_interval(vmin, vmax)

[Deprecated]

Notes

Deprecated since version 3.5: Use .Axis.set_data_interval instead.

set_params(numticks=None, presets=None)[source]

Set parameters within this locator.

set_view_interval(vmin, vmax)

[Deprecated]

Notes

Deprecated since version 3.5: Use .Axis.set_view_interval instead.

tick_values(vmin, vmax)[source]

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]
view_limits(vmin, vmax)[source]

Try to choose the view limits intelligently.