wildboar.utils.plot
#
Plotting utilities.
Functions#
|
Plot the samples in the frequency domain. |
|
Plot the samples in the time domain. |
- wildboar.utils.plot.plot_frequency_domain(x, y=None, *, ax=None, n_samples=100, jitter=False, spectrum='amplitude', sample_spacing=1, bins=None, cmap='Dark2')[source]#
Plot the samples in the frequency domain.
- Parameters:
- xarray-like of shape (n_sample, n_timestep)
The samples.
- yarray-like of shape (n_samples, ), optional
The labels.
- axAxes, optional
The matplotlib Axes-object.
- n_samplesint, optional
The maximum number of samples to plot. If n_samples is larger than the number of samples in x or None, all samples are plotted.
- jitterbool, optional
Add jitter to the amplitude lines.
- spectrum{“amplitude”, “phase”}, optional
The spectrum.
- sample_spacingint, optional
The frequency domain sample spacing.
- binsbool, optional
Show the frequency bins.
- cmapstr, optional
The colormap.
- Returns:
- Axes
The axes object that has been plotted.
Examples
>>> from wildboar.utils.plot import plot_frequency_domain >>> from wildboar.datasets import load_gun_point >>> X, y = load_gun_point() >>> plot_frequency_domain(X, y, n_sample=10)
- wildboar.utils.plot.plot_time_domain(x, y=None, *, n_samples=100, ax=None, alpha=0.5, linewidth=0.5, zorder=-1, cmap='Dark2', show_legend=8)[source]#
Plot the samples in the time domain.
- Parameters:
- xarray-like of shape (n_sample, n_timestep)
The samples.
- yarray-like of shape (n_samples, ), optional
The labels, assumed to be discrete labels.
- n_samplesint, optional
The maximum number of samples to plot. If n_samples is larger than the number of samples in x or None, all samples are plotted.
- axAxes, optional
The matplotlib Axes-object.
- alphafloat, optional
The opacity of the samples.
- linewidthfloat, optional
The width of the sample lines.
- zorderint, optional
The order where the samples are plotted. By default we plot the samples at -1.
- cmapstr, optional
The colormap used to colorize samples according to its label.
- show_legendbool or int, optional
Whether the legend of labels are show.
if bool, show the legend if y is not None
if int, show the legend if the number of labels are lower than the show_legend parameter value
- Returns:
- Axes
The axes object that has been plotted.
Examples
>>> from wildboar.utils.plot import plot_time_domain >>> from wildboar.datasets import load_gun_point >>> X, y = load_gun_point() >>> plot_time_domain(X, y, n_sample=10)