smpl.plot.MaxNLocator¶
- class smpl.plot.MaxNLocator(nbins=None, **kwargs)[source]¶
Bases:
LocatorFind nice tick locations with no more than N being within the view limits. Locations beyond the limits are added to support autoscaling.
- __init__(nbins=None, **kwargs)[source]¶
Parameters¶
- nbinsint or ‘auto’, default: 10
Maximum number of intervals; one less than max number of ticks. If the string ‘auto’, the number of bins will be automatically determined based on the length of the axis.
- stepsarray-like, optional
Sequence of nice numbers starting with 1 and ending with 10; e.g., [1, 2, 4, 5, 10], where the values are acceptable tick multiples. i.e. for the example, 20, 40, 60 would be an acceptable set of ticks, as would 0.4, 0.6, 0.8, because they are multiples of 2. However, 30, 60, 90 would not be allowed because 3 does not appear in the list of steps.
- integerbool, default: False
If True, ticks will take only integer values, provided at least min_n_ticks integers are found within the view limits.
- symmetricbool, default: False
If True, autoscaling will result in a range symmetric about zero.
- prune{‘lower’, ‘upper’, ‘both’, None}, default: None
Remove edge ticks – useful for stacked or ganged plots where the upper tick of one axes overlaps with the lower tick of the axes above it, primarily when :rc:`axes.autolimit_mode` is
'round_numbers'. Ifprune=='lower', the smallest tick will be removed. Ifprune == 'upper', the largest tick will be removed. Ifprune == 'both', the largest and smallest ticks will be removed. If prune is None, no ticks will be removed.- min_n_ticksint, default: 2
Relax nbins and integer constraints if necessary to obtain this minimum number of ticks.
Methods
__init__([nbins])Parameters nbins int or 'auto', default: 10 Maximum number of intervals; one less than max number of ticks. If the string 'auto', the number of bins will be automatically determined based on the length of the axis.
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(**kwargs)Set parameters for 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(dmin, dmax)Select a scale for the range from vmin to vmax.
Attributes
MAXTICKSaxisdefault_params- 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(**kwargs)[source]¶
Set parameters for this locator.
Parameters¶
- nbinsint or ‘auto’, optional
see .MaxNLocator
- stepsarray-like, optional
see .MaxNLocator
- integerbool, optional
see .MaxNLocator
- symmetricbool, optional
see .MaxNLocator
- prune{‘lower’, ‘upper’, ‘both’, None}, optional
see .MaxNLocator
- min_n_ticksint, optional
see .MaxNLocator
- set_view_interval(vmin, vmax)¶
[Deprecated]
Notes¶
Deprecated since version 3.5: Use .Axis.set_view_interval instead.