diff --git a/specparam/objs/data.py b/specparam/objs/data.py index 7823542f..4b40ab32 100644 --- a/specparam/objs/data.py +++ b/specparam/objs/data.py @@ -10,7 +10,7 @@ from specparam.core.errors import DataError, InconsistentDataError from specparam.data import SpectrumMetaData from specparam.plts.settings import PLT_COLORS -from specparam.plts.spectra import plot_spectra +from specparam.plts.spectra import plot_spectra, plot_spectrogram from specparam.plts.utils import check_plot_kwargs ################################################################################################### @@ -381,6 +381,12 @@ def add_data(self, freqs, spectrogram, freq_range=None): super().add_data(freqs, spectrogram, freq_range) + def plot(self, **plt_kwargs): + """Plot the spectrogram.""" + + plot_spectrogram(self.freqs, self.spectrogram, **plot_kwargs) + + class BaseData3D(BaseData2DT): """Base object for managing data for spectral parameterization - for 3D data.""" @@ -440,3 +446,9 @@ def add_data(self, freqs, spectrograms, freq_range=None): # Otherwise, pass through 2d array to underlying object method else: super().add_data(freqs, spectrograms, freq_range) + + + def plot(self, event_ind): + """Plot a selected spectrogram.""" + + plot_spectrogram(self.freqs, self.spectrograms[event_ind, :, :], **plot_kwargs)