# Plot FFT across channels

**URL:** https://mne.discourse.group/t/plot-fft-across-channels/2783
**Category:** Support & Discussions
**Tags:** time-frequency
**Created:** [March 3, 2021, 11:45pm UTC](https://mne.discourse.group/t/plot-fft-across-channels/2783 "2021-03-03T23:45:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ihgumilar](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/ihgumilar/32/97_2.png) [@ihgumilar](https://mne.discourse.group/u/ihgumilar)
#### Post date: [March 3, 2021, 11:45pm UTC](https://mne.discourse.group/t/plot-fft-across-channels/2783/1 "2021-03-03T23:45:13Z")

</div>

Hi,

I am able to plot FFT with Pwelch method for each channels as shown below ![image](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/707af17e5479a3651af58101406eba7b81c460a9.png)

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

```python

_, 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')
plt.show()

```

Thanks  
Ihshan

---

<div class="post-metadata">

### Author: ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)
#### Post date: [April 2, 2021, 9:04pm UTC](https://mne.discourse.group/t/plot-fft-across-channels/2783/2 "2021-04-02T21:04:46Z")

</div>

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:

[https://mne.tools/dev/auto\_tutorials/raw/plot\_40\_visualize\_raw.html#plotting-spectral-density-of-continuous-data](https://mne.tools/dev/auto_tutorials/raw/plot_40_visualize_raw.html#plotting-spectral-density-of-continuous-data)

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.

---

<div class="post-metadata">

### Author: ![ihgumilar](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/ihgumilar/32/97_2.png) [@ihgumilar](https://mne.discourse.group/u/ihgumilar)
#### Post date: [April 7, 2021, 9:32pm UTC](https://mne.discourse.group/t/plot-fft-across-channels/2783/3 "2021-04-07T21:32:41Z")

</div>

Ahh I see…we need to aggregate over channel first
