# Add vertical lines to mne.viz.plot\_raw(raw)

**URL:** <https://mne.discourse.group/t/add-vertical-lines-to-mne-viz-plot-raw-raw/3308>\
**Category:** Support & Discussions\
**Tags:** visualization\
**Created:** [June 23, 2021, 5:13pm UTC](https://mne.discourse.group/t/add-vertical-lines-to-mne-viz-plot-raw-raw/3308 "2021-06-23T17:13:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jani](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@Jani](https://mne.discourse.group/u/Jani)\
**Post date:** [June 23, 2021, 5:13pm UTC](https://mne.discourse.group/t/add-vertical-lines-to-mne-viz-plot-raw-raw/3308/1 "2021-06-23T17:13:28Z")

</div>

Hello!

I have following line of code  
fig = mne.viz.plot\_raw(raw\_selection, start=start, duration=duration, show=False,  
show\_scrollbars=False, show\_scalebars=False, n\_channels=len(ch\_names))

It plots roughly 25 channels worth of raw data. What I would like to do, is add vertical lines to this figure in the spot where there are integer valued seconds, such as [73, 74 75] etc. How to do this? I have tried adding grids, using ax.axvline functions etc. but I can’t get any lines to show.

- MNE-Python version: 0.23

---

<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:** [June 23, 2021, 6:46pm UTC](https://mne.discourse.group/t/add-vertical-lines-to-mne-viz-plot-raw-raw/3308/2 "2021-06-23T18:46:27Z")

</div>

you can access the main plot axes object like this: `fig.mne.ax_main`. So something like

```python
fig = raw.plot()
fig.mne.ax_main.axvline(74, color='green', linestyle='--')

```

should work.

---

<div class="post-metadata">

**Author:** ![Jani](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@Jani](https://mne.discourse.group/u/Jani)\
**Post date:** [June 28, 2021, 6:33am UTC](https://mne.discourse.group/t/add-vertical-lines-to-mne-viz-plot-raw-raw/3308/3 "2021-06-28T06:33:52Z")

</div>

Hi,

Thanks for your quick response @drammock. This worked!
