neurodsp.plts.plot_spectral_hist(freqs, power_bins, spectral_hist, spectrum_freqs=None, spectrum=None, ax=None, **kwargs)[source]

Plot spectral histogram.

freqs1d array

Frequencies over which the histogram is calculated.

power_bins1d array

Power bins within which histogram is aggregated.

spectral_hist2d array

Spectral histogram to be plotted.

spectrum_freqs1d array, optional

Frequency axis of the power spectrum to be plotted.

spectrum1d array, optional

Spectrum to be plotted over the histograms.

axmatplotlib.Axes, optional

Figure axes upon which to plot.


Keyword arguments for customizing the plot.


Plot a spectral histogram:

>>> from neurodsp.sim import sim_combined
>>> from neurodsp.spectral import compute_spectral_hist
>>> sig = sim_combined(n_seconds=100, fs=500,
...                    components={'sim_synaptic_current': {},
...                                'sim_bursty_oscillation' : {'freq': 10}},
...                    component_variances=(0.5, 1))
>>> freqs, bins, spect_hist = compute_spectral_hist(sig, fs=500, nbins=40, f_range=(1, 75),
...                                                 cut_pct=(0.1, 99.9))
>>> plot_spectral_hist(freqs, bins, spect_hist)

Examples using neurodsp.plts.plot_spectral_hist