apollon.aplot module

apollon/aplot.py

General plotting routines.

Licensed under the terms of the BSD-3-Clause license. Copyright (C) 2019 Michael Blaß mblass@posteo.net

Functions:

fourplot Create a four plot of time a signal. marginal_distr Plot the marginal distribution of a PoissonHMM. onsets Plot onsets over a signal. onest_decoding Plot decoded onsets over a signal. signal Plot a time domain signal.

apollon.aplot.center_spines(axs: Union[matplotlib.axes._axes.Axes, Iterable[matplotlib.axes._axes.Axes]], intersect: Tuple[float, float] = (0.0, 0.0))None

Display axes in crosshair fashion.

Parameters
  • axs – Axis or iterable of axes.

  • intersect – Coordinate of axes’ intersection point.

apollon.aplot.fourplot(data: numpy.ndarray, lag: int = 1)tuple

Plot time series, lag-plot, histogram, and probability plot.

Parameters
  • data – Input data set.

  • lag – Lag for lag-plot given in number of samples.

Returns

Parameters

apollon.aplot.marginal_distr(train_data: numpy.ndarray, state_means: numpy.ndarray, stat_dist: numpy.ndarray, bins: int = 20, legend: bool = True, **kwargs)tuple

Plot the marginal distribution of a PoissonHMM.

Parameters
  • train_data – Training data set.

  • state_means – State dependend means.

  • stat_dist – Stationary distribution.

Returns

Figure and Axes.

apollon.aplot.onset_decoding(odf: numpy.ndarray, onset_index: numpy.ndarray, decoding: numpy.ndarray, cmap='viridis', **kwargs)tuple

Plot sig and and onsetes color coded regarding dec.

Parameters
  • odf – Onset detection function or an arbitrary time series.

  • onset_index – Onset indices relative to odf.

  • decoding – State codes in [0, …, n].

  • cmap – Colormap for onsets.

Returns

Figure and axes.

apollon.aplot.onsets(sig, ons, **kwargs)tuple

Indicate onsets on a time series.

Parameters
  • sig – Input to onset detection.

  • ons – Onset detector instance.

Returns

Figure and axes.

apollon.aplot.outward_spines(axs: Union[matplotlib.axes._axes.Axes, Iterable[matplotlib.axes._axes.Axes]], offset: float = 10.0)None

Display only left and bottom spine and displace them.

Parameters
  • axs – Axis or iterable of axes.

  • offset – Move the spines offset pixels in the negative direction.

Note

Increasing offset may breaks the layout. Since the spine is moved, so is the axis label, which is in turn forced out of the figure’s bounds.

apollon.aplot.signal(values: numpy.ndarray, fps: Optional[int] = None, **kwargs)tuple

Plot time series with constant sampling interval.

Parameters
  • values – Values of the time series.

  • fps – Sampling frequency in samples.

  • time_scale – Seconds or samples.

Returns

Figure and axes.