I want to plot a grid of images of a galaxy with matplotlib while only keeping the RA and DEC ticks/labels on the left and lower edge plots to make the figure less cluttered.
However, I have noticed that once you use the WCS projection, you cannot longer clear the axis labels, ticks or locators. This code reproduces the issue:
import matplotlib.pyplot as plt
from astropy.wcs import WCS
from astropy.io import fits
from astropy.utils.data import get_pkg_data_filename
filename = get_pkg_data_filename('galactic_center/gc_msx_e.fits')
hdu = fits.open(filename)[0]
wcs = WCS(hdu.header)
ax = plt.subplot(projection=wcs)
ax.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')
ax.grid(color='white', ls='solid')
ax.update({'xlabel': 'Galactic Longitude', 'ylabel': ''})
ax.yaxis.set_ticklabels([], minor=True)
ax.yaxis.set_major_locator(plt.NullLocator())
plt.show()
I wonder if anyone has a suggestion on how to do this while keeping the projection.
Thank you