smpl.plot.LogFormatter¶
- class smpl.plot.LogFormatter(base=10.0, labelOnlyBase=False, minor_thresholds=None, linthresh=None)[source]¶
Bases:
FormatterBase class for formatting ticks on a log or symlog scale.
It may be instantiated directly, or subclassed.
Parameters¶
- basefloat, default: 10.
Base of the logarithm used in all calculations.
- labelOnlyBasebool, default: False
If True, label ticks only at integer powers of base. This is normally True for major ticks and False for minor ticks.
- minor_thresholds(subset, all), default: (1, 0.4)
If labelOnlyBase is False, these two numbers control the labeling of ticks that are not at integer powers of base; normally these are the minor ticks. The controlling parameter is the log of the axis data range. In the typical case where base is 10 it is the number of decades spanned by the axis, so we can call it ‘numdec’. If
numdec <= all, all minor ticks will be labeled. Ifall < numdec <= subset, then only a subset of minor ticks will be labeled, so as to avoid crowding. Ifnumdec > subsetthen no minor ticks will be labeled.- linthreshNone or float, default: None
If a symmetric log scale is in use, its
linthreshparameter must be supplied here.
Notes¶
The set_locs method must be called to enable the subsetting logic controlled by the
minor_thresholdsparameter.In some cases such as the colorbar, there is no distinction between major and minor ticks; the tick locations might be set manually, or by a locator that puts ticks at integer powers of base and at intermediate locations. For this situation, disable the minor_thresholds logic by using
minor_thresholds=(np.inf, np.inf), so that all ticks will be labeled.To disable labeling of minor ticks when ‘labelOnlyBase’ is False, use
minor_thresholds=(0, 0). This is the default for the “classic” style.Examples¶
To label a subset of minor ticks when the view limits span up to 2 decades, and all of the ticks when zoomed in to 0.5 decades or less, use
minor_thresholds=(2, 0.5).To label all minor ticks when the view limits span up to 1.5 decades, use
minor_thresholds=(1.5, 1.5).Methods
__init__([base, labelOnlyBase, ...])base(base)[Deprecated] Change the base for labeling.
create_dummy_axis(**kwargs)fix_minus(s)Some classes may want to replace a hyphen for minus with the proper Unicode symbol (U+2212) for typographical correctness. This is a helper method to perform such a replacement when it is enabled via :rc:`axes.unicode_minus`.
format_data(value)Return the full string representation of the value with the position unspecified.
format_data_short(value)Return a short string version of the tick value.
format_ticks(values)Return the tick labels for all the ticks at once.
get_offset()label_minor(labelOnlyBase)[Deprecated] Switch minor tick labeling on or off.
set_axis(axis)set_base(base)Change the base for labeling.
set_bounds(vmin, vmax)[Deprecated]
set_data_interval(vmin, vmax)[Deprecated]
set_label_minor(labelOnlyBase)Switch minor tick labeling on or off.
set_locs([locs])Use axis view limits to control which ticks are labeled.
set_view_interval(vmin, vmax)[Deprecated]
Attributes
axislocs- base(base)[source]¶
[Deprecated] Change the base for labeling.
Warning
Should always match the base used for
LogLocatorNotes¶
Deprecated since version 3.6: Use set_base() instead.
- static fix_minus(s)¶
Some classes may want to replace a hyphen for minus with the proper Unicode symbol (U+2212) for typographical correctness. This is a helper method to perform such a replacement when it is enabled via :rc:`axes.unicode_minus`.
- format_data(value)[source]¶
Return the full string representation of the value with the position unspecified.
- format_data_short(value)[source]¶
Return a short string version of the tick value.
Defaults to the position-independent long value.
- format_ticks(values)¶
Return the tick labels for all the ticks at once.
- label_minor(labelOnlyBase)[source]¶
[Deprecated] Switch minor tick labeling on or off.
Parameters¶
- labelOnlyBasebool
If True, label ticks only at integer powers of base.
Notes¶
Deprecated since version 3.6: Use set_label_minor() instead.
- set_base(base)[source]¶
Change the base for labeling.
Warning
Should always match the base used for
LogLocator
- 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_label_minor(labelOnlyBase)[source]¶
Switch minor tick labeling on or off.
Parameters¶
- labelOnlyBasebool
If True, label ticks only at integer powers of base.