# difference between Raw.plot\_psd and plot via computing psd and freq by psd\_multitaper

**URL:** <https://mne.discourse.group/t/difference-between-raw-plot-psd-and-plot-via-computing-psd-and-freq-by-psd-multitaper/1095>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [October 5, 2016, 5:56pm UTC](https://mne.discourse.group/t/difference-between-raw-plot-psd-and-plot-via-computing-psd-and-freq-by-psd-multitaper/1095 "2016-10-05T17:56:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [October 5, 2016, 5:56pm UTC](https://mne.discourse.group/t/difference-between-raw-plot-psd-and-plot-via-computing-psd-and-freq-by-psd-multitaper/1095/1 "2016-10-05T17:56:36Z")

</div>

Hi all,

I am trying to plot the power spectral density of 6 EEG channels  
(F3,F4,C3,C4,O1,O2), but Raw.plot\_psd gives me a very different plot  
compared to plotting the freq and psd computed by psd\_multitaper. Here is  
the code:

raw.plot\_psd(tmin=0,tmax=60,fmin=0,fmax=50,area\_mode='std')

f,ax=plt.subplots()  
psds,freqs=psd\_multitaper(raw,low\_bias=True,tmin=0,tmax=60,  
bandwidth=None,fmin=0,fmax=50,proj=True,picks=picks,n\_jobs=1)

psds = 10\*np.log10(psds)  
psds\_mean = psds.mean(0)  
psds\_std = psds.std(0)

ax.plot(freqs,psds\_mean,color='k')  
ax.fill\_between(freqs,psds\_mean - psds\_std, psds\_mean + psds\_std,color='k',  
alpha=.5)

Here are the graphs:

[image: Inline image 2][image: Inline image 1]  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161005/2a916d40/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161005/2a916d40/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: image.png  
Type: image/png  
Size: 28587 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161005/2a916d40/attachment-0002.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161005/2a916d40/attachment-0002.png)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: image.png  
Type: image/png  
Size: 155405 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161005/2a916d40/attachment-0003.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161005/2a916d40/attachment-0003.png)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [October 5, 2016, 10:15pm UTC](https://mne.discourse.group/t/difference-between-raw-plot-psd-and-plot-via-computing-psd-and-freq-by-psd-multitaper/1095/2 "2016-10-05T22:15:56Z")

</div>

`raw.plot_psd` uses the Welch method by chunking the signal in time,  
whereas `psd_multitaper` does not.

Eric

> Hi all,
> 
> I am trying to plot the power spectral density of 6 EEG channels  
> (F3,F4,C3,C4,O1,O2), but Raw.plot\_psd gives me a very different plot  
> compared to plotting the freq and psd computed by psd\_multitaper. Here is  
> the code:
> 
> raw.plot\_psd(tmin=0,tmax=60,fmin=0,fmax=50,area\_mode='std')
> 
> f,ax=plt.subplots()  
> psds,freqs=psd\_multitaper(raw,low\_bias=True,tmin=0,tmax=60,b  
> andwidth=None,fmin=0,fmax=50,proj=True,picks=picks,n\_jobs=1)
> 
> psds = 10\*np.log10(psds)  
> psds\_mean = psds.mean(0)  
> psds\_std = psds.std(0)
> 
> ax.plot(freqs,psds\_mean,color='k')  
> ax.fill\_between(freqs,psds\_mean - psds\_std, psds\_mean +  
> psds\_std,color='k', alpha=.5)
> 
> Here are the graphs:
> 
> [image: Inline image 2][image: Inline image 1]
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Mne\_analysis mailing list  
> Mne\_analysis at nmr.mgh.harvard.edu  
> [https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne\_analysis](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> The information in this e-mail is intended only for the person to whom it  
> is  
> addressed. If you believe this e-mail was sent to you in error and the  
> e-mail  
> contains patient information, please contact the Partners Compliance  
> HelpLine at  
> [http://www.partners.org/complianceline](http://www.partners.org/complianceline) . If the e-mail was sent to you in  
> error  
> but does not contain patient information, please contact the sender and  
> properly  
> dispose of the e-mail.

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161006/8fc9eeae/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161006/8fc9eeae/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: image.png  
Type: image/png  
Size: 155405 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161006/8fc9eeae/attachment-0002.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161006/8fc9eeae/attachment-0002.png)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: image.png  
Type: image/png  
Size: 28587 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161006/8fc9eeae/attachment-0003.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161006/8fc9eeae/attachment-0003.png)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [October 5, 2016, 10:46pm UTC](https://mne.discourse.group/t/difference-between-raw-plot-psd-and-plot-via-computing-psd-and-freq-by-psd-multitaper/1095/3 "2016-10-05T22:46:27Z")

</div>

Thank you very much!

Ning

> `raw.plot_psd` uses the Welch method by chunking the signal in time,  
> whereas `psd_multitaper` does not.
> 
> Eric
> 
> > Hi all,
> > 
> > I am trying to plot the power spectral density of 6 EEG channels  
> > (F3,F4,C3,C4,O1,O2), but Raw.plot\_psd gives me a very different plot  
> > compared to plotting the freq and psd computed by psd\_multitaper. Here is  
> > the code:
> > 
> > raw.plot\_psd(tmin=0,tmax=60,fmin=0,fmax=50,area\_mode='std')
> > 
> > f,ax=plt.subplots()  
> > psds,freqs=psd\_multitaper(raw,low\_bias=True,tmin=0,tmax=60,b  
> > andwidth=None,fmin=0,fmax=50,proj=True,picks=picks,n\_jobs=1)
> > 
> > psds = 10\*np.log10(psds)  
> > psds\_mean = psds.mean(0)  
> > psds\_std = psds.std(0)
> > 
> > ax.plot(freqs,psds\_mean,color='k')  
> > ax.fill\_between(freqs,psds\_mean - psds\_std, psds\_mean +  
> > psds\_std,color='k', alpha=.5)
> > 
> > Here are the graphs:
> > 
> > [image: Inline image 2][image: Inline image 1]
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Mne\_analysis mailing list  
> > Mne\_analysis at nmr.mgh.harvard.edu  
> > [https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne\_analysis](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> > 
> > The information in this e-mail is intended only for the person to whom it  
> > is  
> > addressed. If you believe this e-mail was sent to you in error and the  
> > e-mail  
> > contains patient information, please contact the Partners Compliance  
> > HelpLine at  
> > [http://www.partners.org/complianceline](http://www.partners.org/complianceline) . If the e-mail was sent to you  
> > in error  
> > but does not contain patient information, please contact the sender and  
> > properly  
> > dispose of the e-mail.
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Mne\_analysis mailing list  
> Mne\_analysis at nmr.mgh.harvard.edu  
> [https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne\_analysis](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> The information in this e-mail is intended only for the person to whom it  
> is  
> addressed. If you believe this e-mail was sent to you in error and the  
> e-mail  
> contains patient information, please contact the Partners Compliance  
> HelpLine at  
> [http://www.partners.org/complianceline](http://www.partners.org/complianceline) . If the e-mail was sent to you in  
> error  
> but does not contain patient information, please contact the sender and  
> properly  
> dispose of the e-mail.

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161005/14e72b29/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161005/14e72b29/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: image.png  
Type: image/png  
Size: 155405 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161005/14e72b29/attachment-0002.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161005/14e72b29/attachment-0002.png)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: image.png  
Type: image/png  
Size: 28587 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161005/14e72b29/attachment-0003.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161005/14e72b29/attachment-0003.png)
