mplsignal.ticker#

This module contains Matplotlib Ticker and
Locator classes suitable for signal processing
plots.
- class mplsignal.ticker.DegreeFormatter(digits=3, **kwargs)#
Bases:
FactorFormatterCreate a string with a trailing \(^{\circ}\).
- Parameters:
- digitsint, default: 3
Number of digits to round fractional numbers to.
- fsfloat, default: 1.0
The sample frequency in Hz.
- **kwargs
Additional arguments passed to
FactorFormatter. Cannot include factor, name, and only_name_when_one.
- Attributes:
- axis
Methods
__call__(x[, pos])Return the format for tick value x at position pos.
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.
set_locs(locs)Set the locations of the ticks.
create_dummy_axis
get_offset
set_axis
- class mplsignal.ticker.DegreeLocator(nbins=None, **kwargs)#
Bases:
MaxNLocatorLocator for finding multiples that are nice when using degrees.
- Parameters:
- nbinsint
Number of bins to aim for, see
MaxNLocator.
- Attributes:
- axis
Methods
__call__()Return the locations of the ticks.
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_params(**kwargs)Set parameters for this locator.
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.
create_dummy_axis
set_axis
- class mplsignal.ticker.FactorFormatter(digits=3, factor=1.0, name='constant', only_name_when_one=True, **kwargs)#
Bases:
FormatterCreate a string based on a tick value and location as a multiple of factor.
- Parameters:
- digitsint, default: 3
Number of digits to round fractional numbers to.
- factorfloat, default: 1.0
The factor.
- namestr, optional
The name of the factor.
- only_name_when_onebool, default True
If True, 1 returns name, if False, 1 returns 1*name*.
- **kwargs
Additional arguments passed to
Formatter.
- Attributes:
- axis
Methods
__call__(x[, pos])Return the format for tick value x at position pos.
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.
set_locs(locs)Set the locations of the ticks.
create_dummy_axis
get_offset
set_axis
- locs = []#
- class mplsignal.ticker.FactorLocator(factor=1.0, nbins=None, **kwargs)#
Bases:
LocatorLocator for finding multiples of factor.
Wraps a
MaxNLocator.- Parameters:
- factorfloat
The factor to extract.
- nbinsint
Number of bins to aim for, see
MaxNLocator.- **kwargs
Additional arguments passed to
MaxNLocator.
- Attributes:
- axis
Methods
__call__()Return the locations of the ticks.
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_params(**kwargs)Do nothing, and raise a warning.
tick_values(vmin, vmax)Return the values of the located ticks given vmin and vmax.
view_limits(vmin, vmax)Select a scale for the range from vmin to vmax.
create_dummy_axis
set_axis
- tick_values(vmin, vmax)#
Return the values of the located ticks given vmin and vmax.
- class mplsignal.ticker.PiFormatter(digits=3, **kwargs)#
Bases:
FactorFormatterCreate a string with multiple of \(\pi\).
- Parameters:
- digitsint, default: 3
Number of digits to round fractional numbers to.
- **kwargs
Additional arguments passed to
FactorFormatter. Cannot include factor and name.
- Attributes:
- axis
Methods
__call__(x[, pos])Return the format for tick value x at position pos.
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.
set_locs(locs)Set the locations of the ticks.
create_dummy_axis
get_offset
set_axis
- class mplsignal.ticker.PiLocator(nbins=None, **kwargs)#
Bases:
FactorLocatorLocator for finding multiples of \(\pi\).
- Parameters:
- nbinsint
Number of bins to aim for, see
MaxNLocator.
- Attributes:
- axis
Methods
__call__()Return the locations of the ticks.
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_params(**kwargs)Do nothing, and raise a warning.
tick_values(vmin, vmax)Return the values of the located ticks given vmin and vmax.
view_limits(vmin, vmax)Select a scale for the range from vmin to vmax.
create_dummy_axis
set_axis
- class mplsignal.ticker.PiRationalFormatter(digits=3, pi_always_in_numerator=True, **kwargs)#
Bases:
FormatterCreate a string with rational multiple of \(\pi\).
- Parameters:
- digitsint, default: 3
Number of digits to round fractional numbers to.
- pi_always_in_numerator: bool, default: True
If True, the strings will look like \(\frac{2\pi}{5}\), if False, like \(\frac{2}{5}\pi\)
- **kwargs
Additional arguments passed to
Formatter.
- Attributes:
- axis
Methods
__call__(x[, pos])Return the format for tick value x at position pos.
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.
set_locs(locs)Set the locations of the ticks.
create_dummy_axis
get_offset
set_axis
- locs = []#
- class mplsignal.ticker.SampleFrequencyFormatter(digits=3, fs=1.0, **kwargs)#
Bases:
FactorFormatterCreate a string with multiple of sample frequency, \(f_s\).
- Parameters:
- digitsint, default: 3
Number of digits to round fractional numbers to.
- fsfloat, default: 1.0
The sample frequency in Hz.
- **kwargs
Additional arguments passed to
FactorFormatter. Cannot include factor and name.
- Attributes:
- axis
Methods
__call__(x[, pos])Return the format for tick value x at position pos.
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.
set_locs(locs)Set the locations of the ticks.
create_dummy_axis
get_offset
set_axis
- class mplsignal.ticker.SampleFrequencyLocator(nbins=None, fs=1.0, **kwargs)#
Bases:
FactorLocatorLocator for finding multiples of sample frequency.
- Attributes:
- axis
Methods
__call__()Return the locations of the ticks.
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_params(**kwargs)Do nothing, and raise a warning.
tick_values(vmin, vmax)Return the values of the located ticks given vmin and vmax.
view_limits(vmin, vmax)Select a scale for the range from vmin to vmax.
create_dummy_axis
set_axis