smpl.plot.FixedLocator

class smpl.plot.FixedLocator(locs, nbins=None)[source]

Bases: Locator

Tick locations are fixed. If nbins is not None, the array of possible positions will be subsampled to keep the number of ticks <= nbins +1. The subsampling will be done so as to include the smallest absolute value; for example, if zero is included in the array of possibilities, then it is guaranteed to be one of the chosen ticks.

__init__(locs, nbins=None)[source]

Methods

__init__(locs[, nbins])

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([nbins])

Set parameters within this locator.

set_view_interval(vmin, vmax)

[Deprecated]

tick_values(vmin, vmax)

Return the locations of the ticks.

view_limits(vmin, vmax)

Select a scale for the range from vmin to vmax.

Attributes

MAXTICKS

axis

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(nbins=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 locations of the ticks.

Note

Because the values are fixed, vmin and vmax are not used in this method.

view_limits(vmin, vmax)

Select a scale for the range from vmin to vmax.

Subclasses should override this method to change locator behaviour.