smpl.plot.LogLocator

class smpl.plot.LogLocator(base=10.0, subs=(1.0,), numdecs=4, numticks=None)[source]

Bases: Locator

Determine the tick locations for log axes

__init__(base=10.0, subs=(1.0,), numdecs=4, numticks=None)[source]

Place ticks on the locations : subs[j] * base**i

Parameters

basefloat, default: 10.0

The base of the log used, so major ticks are placed at base**n, n integer.

subsNone or str or sequence of float, default: (1.0,)

Gives the multiples of integer powers of the base at which to place ticks. The default places ticks only at integer powers of the base. The permitted string values are 'auto' and 'all', both of which use an algorithm based on the axis view limits to determine whether and how to put ticks between integer powers of the base. With 'auto', ticks are placed only between integer powers; with 'all', the integer powers are included. A value of None is equivalent to 'auto'.

numticksNone or int, default: None

The maximum number of ticks to allow on a given axis. The default of None will try to choose intelligently as long as this Locator has already been assigned to an axis using ~.axis.Axis.get_tick_space, but otherwise falls back to 9.

Methods

__init__([base, subs, numdecs, numticks])

Place ticks on the locations : subs[j] * base**i

base(base)

[Deprecated] Set the log base (major tick every base**i, i integer).

create_dummy_axis(**kwargs)

nonsingular(vmin, vmax)

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([base, subs, numdecs, numticks])

Set parameters within this locator.

set_view_interval(vmin, vmax)

[Deprecated]

subs(subs)

[Deprecated] Set the minor ticks for the log scaling every base**i*subs[j].

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

base(base)[source]

[Deprecated] Set the log base (major tick every base**i, i integer).

Notes

Deprecated since version 3.6: Use set_params(base=…) instead.

nonsingular(vmin, vmax)[source]

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(base=None, subs=None, numdecs=None, numticks=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.

subs(subs)[source]

[Deprecated] Set the minor ticks for the log scaling every base**i*subs[j].

Notes

Deprecated since version 3.6: Use set_params(subs=…) 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.