How can I plot the evoked conditions better

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)

Thank you!

Try this:

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)
1 Like

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.

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

1 Like

@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!

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>

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.

1 Like

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

@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!

@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

@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!

1 Like

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,

1 Like