# Viz compare incomplete axis

**URL:** <https://mne.discourse.group/t/viz-compare-incomplete-axis/5230>\
**Category:** Support & Discussions\
**Tags:** evoked\
**Created:** [July 6, 2022, 12:32pm UTC](https://mne.discourse.group/t/viz-compare-incomplete-axis/5230 "2022-07-06T12:32:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evelyne\_Fraats](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/evelyne_fraats/32/1729_2.png) [@Evelyne\_Fraats](https://mne.discourse.group/u/Evelyne_Fraats)\
**Post date:** [July 6, 2022, 12:32pm UTC](https://mne.discourse.group/t/viz-compare-incomplete-axis/5230/1 "2022-07-06T12:32:49Z")

</div>

Hi all! Im a trying to plot my evokeds. However, when using `mne.viz.plot_compare_evokeds` I get a incomplete x axis:

![erp wrong](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/f/fc30d00075400c380d2e3aae2de684a246cad3a4.jpeg)

This is my code:

```python
import matplotlib.pyplot as plt

fig, axes = plt.subplots(1) # assuming 3 channel types
axes.set_xlim([-8,8])
axes.set_ylim([-6,6])
mne.viz.plot_compare_evokeds(dict(indoor = indoor_evoked, outdoor_natural = outdoor_natural_evoked, outdoor_manmade = outdoor_manmade_evoked),legend='upper right', show_sensors= False, ci=0.99, axes = axes)
fig.savefig('POZ_ERP_task_indep.png')

```

---

<div class="post-metadata">

**Author:** ![mscheltienne](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mscheltienne/32/827_2.png) [@mscheltienne](https://mne.discourse.group/u/mscheltienne)\
**Post date:** [July 6, 2022, 12:46pm UTC](https://mne.discourse.group/t/viz-compare-incomplete-axis/5230/2 "2022-07-06T12:46:06Z")

</div>

Hello,

You are setting the xlim and ylim first, and then you overwrite them by plotting on-top with `plot_compare_evokeds`. I suspect that you’ll get the correct output if you move the `set_*lim` after `plot_compare_evokeds`.

Mathieu

---

<div class="post-metadata">

**Author:** ![Evelyne\_Fraats](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/evelyne_fraats/32/1729_2.png) [@Evelyne\_Fraats](https://mne.discourse.group/u/Evelyne_Fraats)\
**Post date:** [July 6, 2022, 1:16pm UTC](https://mne.discourse.group/t/viz-compare-incomplete-axis/5230/3 "2022-07-06T13:16:27Z")

</div>

Hello Mathieu!  
Thank you for your answer. I tried it but it did not work.

---

<div class="post-metadata">

**Author:** ![mscheltienne](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mscheltienne/32/827_2.png) [@mscheltienne](https://mne.discourse.group/u/mscheltienne)\
**Post date:** [July 6, 2022, 1:36pm UTC](https://mne.discourse.group/t/viz-compare-incomplete-axis/5230/4 "2022-07-06T13:36:42Z")

</div>

Ok, let’s try a couple of points:

- first, can you tell us how long (in seconds) are each of the evoked?
- second, what is your mne version?
- third, let’s try without creating a figure beforehand and without changing the axis limits:

```python
fig = mne.viz.plot_compare_evokeds(...) # returns a list of figures
fig[0].savefig(...)

```

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [July 6, 2022, 1:48pm UTC](https://mne.discourse.group/t/viz-compare-incomplete-axis/5230/5 "2022-07-06T13:48:33Z")

</div>

The function also has two parameters related to axis truncation, maybe check out these as well.

---

<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:** [July 6, 2022, 3:48pm UTC](https://mne.discourse.group/t/viz-compare-incomplete-axis/5230/6 "2022-07-06T15:48:11Z")

</div>

as @richard says, look at the parameters `truncate_xaxis` and `truncate_yaxis` in the `plot_compare_evokeds` function. That is what causes the axis truncation.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [July 6, 2022, 7:28pm UTC](https://mne.discourse.group/t/viz-compare-incomplete-axis/5230/7 "2022-07-06T19:28:13Z")

</div>

@Evelyne_Fraats btw, the defaults will look much better with a recent version of MNE-Python. I think I changed these settings a short while ago; either the improvements are already included in MNE-Python 1.0, or will be in the very-soon-to-be-released 1.1.
