# How can I plot the evoked conditions better

**URL:** <https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683>\
**Category:** Support & Discussions\
**Tags:** eeg, visualization, evoked\
**Created:** [April 6, 2023, 4:29am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683 "2023-04-06T04:29:09Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esha](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@Esha](https://mne.discourse.group/u/Esha)\
**Post date:** [April 6, 2023, 4:29am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/1 "2023-04-06T04:29:09Z")

</div>

I am working on comparing evoked parameter for two conditions but the signal activity of the signal is not really visible. I would be grateful if I could get suggestions on how can I plot the signal in a way that the signal activity is actually visible and comparable.  
My code -

evokeds = dict(  
Up\_and\_Down\_Eye\_Movements=evoked\_Up\_and\_Down\_Eye\_Movements,  
Side\_to\_Side\_Eye\_Movements=evoked\_Side\_to\_Side\_Eye\_Movements,  
)

picks = [‘Channel 1’, ‘Channel 2’, ‘Channel 3’, ‘Channel 4’]

mne.viz.plot\_compare\_evokeds(evokeds, picks=picks, combine=None, ylim=dict(eeg=[-50, 50]), ci=False, invert\_y=False, truncate\_xaxis=False)

 ![evk comparison](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/3/31e50c0e80bc0fedd7383110e0878fcacb00d61d.png)

Thank you!

---

<div class="post-metadata">

**Author:** ![wmvanvliet](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/wmvanvliet/32/100_2.png) [@wmvanvliet](https://mne.discourse.group/u/wmvanvliet)\
**Post date:** [April 6, 2023, 2:18pm UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/2 "2023-04-06T14:18:40Z")

</div>

Try this:

```python
evoked_Up_and_Down_Eye_Movements = evoked_Up_and_Down_Eye_Movements.apply_baseline((0, 0.5))
evoked_Side_to_Side_Eye_Movements = evoked_Side_to_Side_Eye_Movements.apply_baseline((0, 0.5))

evokeds = dict(
    Up_and_Down_Eye_Movements=evoked_Up_and_Down_Eye_Movements,
    Side_to_Side_Eye_Movements=evoked_Side_to_Side_Eye_Movements,
)

picks = [‘Channel 1’, ‘Channel 2’, ‘Channel 3’, ‘Channel 4’]

mne.viz.plot_compare_evokeds(evokeds, picks=picks, combine=None, ylim=dict(eeg=[-500E-6, 500E-6]), ci=False, invert_y=False, truncate_xaxis=False)

```

---

<div class="post-metadata">

**Author:** ![Esha](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@Esha](https://mne.discourse.group/u/Esha)\
**Post date:** [April 7, 2023, 6:45am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/3 "2023-04-07T06:45:44Z")

</div>

Thank you so much for your response!  
I tried the solution but I am getting error _**‘TypeError: apply\_baseline() takes from 1 to 2 positional arguments but 3 were given’.**_ Not sure why this is coming up since only 2 arguments were passed.

---

<div class="post-metadata">

**Author:** ![wmvanvliet](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/wmvanvliet/32/100_2.png) [@wmvanvliet](https://mne.discourse.group/u/wmvanvliet)\
**Post date:** [April 7, 2023, 7:06am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/4 "2023-04-07T07:06:15Z")

</div>

My bad. I’ve updated the code above by adding some () that were missing.

---

<div class="post-metadata">

**Author:** ![Rosyl](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rosyl/32/1943_2.png) [@Rosyl](https://mne.discourse.group/u/Rosyl)\
**Post date:** [April 11, 2023, 1:18pm UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/5 "2023-04-11T13:18:22Z")

</div>

@Esha I am curious if this fixed the issue, could you confirm if this was the case (I think you can also mark an answer as the solution). Thank you!

---

<div class="post-metadata">

**Author:** ![Esha](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@Esha](https://mne.discourse.group/u/Esha)\
**Post date:** [April 13, 2023, 5:53am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/6 "2023-04-13T05:53:52Z")

</div>

Thank you for the correction!  
I am still getting an error _ **“ValueError: Image size of 722x68446 pixels is too large. It must be less than 2^16 in each direction.”** _

_ **\<Figure size 800x600 with 1 Axes\>** _

---

<div class="post-metadata">

**Author:** ![Esha](https://avatars.discourse-cdn.com/v4/letter/e/9de053/32.png) [@Esha](https://mne.discourse.group/u/Esha)\
**Post date:** [April 13, 2023, 5:55am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/7 "2023-04-13T05:55:11Z")

</div>

Hey I am sorry , I am still getting a value error that the size of the image is too large. I’ll update as soon as I find a solution.

---

<div class="post-metadata">

**Author:** ![wmvanvliet](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/wmvanvliet/32/100_2.png) [@wmvanvliet](https://mne.discourse.group/u/wmvanvliet)\
**Post date:** [April 15, 2023, 8:01am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/8 "2023-04-15T08:01:05Z")

</div>

> [@wmvanvliet](#):
>
> `ylim=dict(eeg=[-500E-6, 500E-6])`

perhaps that should have been `ylim=dict(eeg=[-500, 500])` instead. I don’t know of the top of my head.

---

<div class="post-metadata">

**Author:** ![Rosyl](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rosyl/32/1943_2.png) [@Rosyl](https://mne.discourse.group/u/Rosyl)\
**Post date:** [April 20, 2023, 9:06am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/9 "2023-04-20T09:06:11Z")

</div>

@drammock, I have struggled with a similar issue so I was wondering if you could have a look at this post and have some advice? Many thanks!

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [April 20, 2023, 6:56pm UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/10 "2023-04-20T18:56:41Z")

</div>

@Rosyl Can you share your full code snippet? Is it a bug for y-axis limit or an error for saving the matplotlib figure?

best,  
Dip

---

<div class="post-metadata">

**Author:** ![Rosyl](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rosyl/32/1943_2.png) [@Rosyl](https://mne.discourse.group/u/Rosyl)\
**Post date:** [April 21, 2023, 8:16am UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/11 "2023-04-21T08:16:38Z")

</div>

@dasdiptyajit thank you for your reply, but I currently don’t have an example at hand. I remembered having the issue a while ago and found this post later on, so I thought to follow up because it’s a useful post for more novice users of mne-nirs (like me) to learn.

(if I do stumble across it again, I’ll make a new thread and refer to this thread.)

Thanks!

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [April 21, 2023, 1:27pm UTC](https://mne.discourse.group/t/how-can-i-plot-the-evoked-conditions-better/6683/12 "2023-04-21T13:27:56Z")

</div>

I see. I am afraid that I can’t help much without looking at the code. I think its not an issue with MNE but rather something to do with plot/saving the figure. Feel free to tag me if you have something in your hand that can reproduce the issue.

best,
