environmentaltools.graphics.spectra
- environmentaltools.graphics.spectra(data, semilog=True, title=None, fname=None, ax=None, xlabel='Periods $T$ (years)', label='LombScargle')[source]
Plot power spectral density from spectral analysis.
Displays the power spectrum with frequency or period on x-axis and power on y-axis, highlighting statistically significant peaks.
- Parameters:
data (pd.DataFrame) – Spectral data with ‘psd’ column for power values and ‘significant’ boolean column. Index contains frequencies/periods.
semilog (bool) – If True, uses semilog y-axis. Defaults to True.
title (str, optional) – Plot title. Defaults to None.
fname (str, optional) – File path to save the plot. If None, displays interactively. Defaults to None.
ax (matplotlib.axes.Axes, optional) – Axis for the plot. Creates new if None. Defaults to None.
xlabel (str) – X-axis label. Defaults to “Periods $T$ (years)”.
label (str) – Legend label for method type (‘LombScargle’, ‘FFT’, etc.). Defaults to ‘LombScargle’.
- Returns:
The axis with the plot.
- Return type:
matplotlib.axes.Axes