# Removing the grid lines from MapSequence plots

**URL:** <https://community.openastronomy.org/t/removing-the-grid-lines-from-mapsequence-plots/1119>\
**Category:** SunPy\
**Tags:** sunpy, question\
**Created:** [October 2, 2024, 6:03am UTC](https://community.openastronomy.org/t/removing-the-grid-lines-from-mapsequence-plots/1119 "2024-10-02T06:03:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trestan](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@Trestan](https://community.openastronomy.org/u/Trestan)\
**Post date:** [October 2, 2024, 6:03am UTC](https://community.openastronomy.org/t/removing-the-grid-lines-from-mapsequence-plots/1119/1 "2024-10-02T06:03:57Z")

</div>

Hi all. I have been having trouble trying to remove the grid lines from animations created by the `plot` method of `sunpy.map.MapSequence`. Assuming we start with something like

```Python
import matplotlib.pyplot as plt
from astropy.visualization import ImageNormalize, SqrtStretch
import sunpy.data.sample
import sunpy.map

seq = sunpy.map.Map([
    sunpy.data.sample.AIA_193_CUTOUT01_IMAGE,
    sunpy.data.sample.AIA_193_CUTOUT02_IMAGE,
    sunpy.data.sample.AIA_193_CUTOUT03_IMAGE,
    sunpy.data.sample.AIA_193_CUTOUT04_IMAGE,
    sunpy.data.sample.AIA_193_CUTOUT05_IMAGE,
], sequence=True)

fig = plt.figure()
ax = fig.add_subplot(projection=seq.maps[0])
ani = seq.plot(axes=ax, norm=ImageNormalize(vmin=0, vmax=5e3, stretch=SqrtStretch()))

plt.show()

```

how would you go about removing the grid lines? It does not appear to be as simple as adding `plt.grid(False)` or `ax.coords.grid(False)` which usually works for static plots. Passing a `plot_function` as a kwarg to the plot method does not seem to work either.

Any help with this would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![nabobalis](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/nabobalis/32/14_2.png) [@nabobalis](https://community.openastronomy.org/u/nabobalis)\
**Post date:** [October 2, 2024, 2:17pm UTC](https://community.openastronomy.org/t/removing-the-grid-lines-from-mapsequence-plots/1119/2 "2024-10-02T14:17:51Z")

</div>

Hi @Trestan,

Can you see if adding the following `plot_function` works for you?

```python
def plot_function(fig, ax, smap):
    ax.coords.grid(False)
    return []

ani = seq.plot(axes=ax, norm=ImageNormalize(vmin=0, vmax=5e3, stretch=SqrtStretch()), plot_function=plot_function)

```

---

<div class="post-metadata">

**Author:** ![Trestan](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@Trestan](https://community.openastronomy.org/u/Trestan)\
**Post date:** [October 2, 2024, 3:32pm UTC](https://community.openastronomy.org/t/removing-the-grid-lines-from-mapsequence-plots/1119/3 "2024-10-02T15:32:20Z")

</div>

Thank you @nabobalis ! This works. With this solution the first frame still has grid lines, but I was able to remove them by calling `plot_function` before `plt.show()`.

I had naively tried

```Python
def plot_function(fig, ax, smap):
    return [ax.coords.grid(False)]

```

which **did not** work.

---

<div class="post-metadata">

**Author:** ![nabobalis](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/nabobalis/32/14_2.png) [@nabobalis](https://community.openastronomy.org/u/nabobalis)\
**Post date:** [October 2, 2024, 6:47pm UTC](https://community.openastronomy.org/t/removing-the-grid-lines-from-mapsequence-plots/1119/4 "2024-10-02T18:47:14Z")

</div>

Yeah the documentation for that function is pretty poor.
