xscale.spectral.tools.plot_spectrum

xscale.spectral.tools.plot_spectrum(spectrum, freqs=None, drop_zero_frequency=True, ax=None, xlog=False, ylog=False, loglog=False, variance_preserving=False, xlim=None, ylim=None, title=None, **kwargs)

Define a nice spectrum with twin x-axis, one with frequencies, the other one with periods.

Parameters:
spectrum : 1d xarray.DataArray or 1darray

The array where the spectrum is stored

freqs: 1d vector, optional

The frequency vector. If None, the frequency vector is inferred from the DataArray

drop_zero_frequency : bool, optional

If True, do not plot the zero frequency

ax : matplotlib axes, optional

If None, uses the current axis.

xlog : bool, optional

If True, use log scaling for the x axis

ylog : bool, optional

If True, use log scaling for the y axis

loglog : bool, optional

If True, use log scaling for both axis

variance_preserving : bool, optional

If True, scale the spectrum by the log of frequencies to use the variance preserving form

xlim : tuple, optional

Set x-axis limits

ylim : tuple, optional

Set y-axis limits

title : string, optional

Set the title

**kwargs : optional

Additional arguments to matplotlib.pyplot.plot