Removing grids from SunPy maps

Hello,

I’m a new user of SunPy and would like to ask a question which, hopefully, has a simple answer. I’m downloading HMI vector magnetograms (hmi.sharp_cea_720s), performing some calculations on them and then plotting them as SunPy maps. The only thing I’ve not been able to do is to remove the grid that appears on each map. For some of the variables that I’m plotting, the grid is a bit distracting and I’d rather remove it. Is there a simple way to do this? Thanks in advance for any advice.

Best wishes,
David

Hi,

So this is very easy to do using matplotlib to turn off the grid on the axes after plotting with Map.plot() like so:

from sunpy.map import Map
from sunpy.data.sample import AIA_211_IMAGE
from matplotlib import pyplot as plt

m = Map(AIA_211_IMAGE)
ax = plt.axes([0, 0, 1, 1], projection=m)
m.plot()
ax.grid(False)
plt.show()

Perfect! Thanks Alasdair

1 Like