Plot FFT across channels


I am able to plot FFT with Pwelch method for each channels as shown below image

I am wondering how can I plot the result across channels, not per channel, which results in one plotted line ?

Here is the code that I use

_, ax = plt.subplots()
ax.plot(freqs_mean, np.transpose(psds_welch_mean), color='r',
        ls='-', label='mean of segments')
ax.set(title='All 16-channels FFT',
       xlabel='Frequency (Hz)', ylabel='Power Spectral Density (dB)')
ax.legend(loc='upper right')


If your data are in an MNE-Python Raw data container, then we have a plotting method raw.plot_psd(average=True) that will do Welch FFT. Examples are here:

If you’re asking how to handle the output of mne.time_frequency.psd_array_welch() so that it’s aggregated over channels, you could average across the channels axis before plotting.

1 Like

Ahh I see…we need to aggregate over channel first