# Removing labels, ticks, formatters in a plot with WCS projection

**URL:** <https://community.openastronomy.org/t/removing-labels-ticks-formatters-in-a-plot-with-wcs-projection/410>\
**Category:** Astropy\
**Tags:** astropy, question\
**Created:** [August 3, 2022, 4:42pm UTC](https://community.openastronomy.org/t/removing-labels-ticks-formatters-in-a-plot-with-wcs-projection/410 "2022-08-03T16:42:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vital-Fernandez](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/vital-fernandez/32/245_2.png) [@Vital-Fernandez](https://community.openastronomy.org/u/Vital-Fernandez)\
**Post date:** [August 3, 2022, 4:42pm UTC](https://community.openastronomy.org/t/removing-labels-ticks-formatters-in-a-plot-with-wcs-projection/410/1 "2022-08-03T16:42:01Z")

</div>

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:

```auto
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()

```

![Figure_1](https://europe1.discourse-cdn.com/flex005/uploads/openastronomy/original/1X/cd021cee735c2bc62f5773a67c8e0f8cbb95ca61.png)

I wonder if anyone has a suggestion on how to do this while keeping the projection.

Thank you

---

<div class="post-metadata">

**Author:** ![Cadair](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/cadair/32/422_2.png) [@Cadair](https://community.openastronomy.org/u/Cadair)\
**Post date:** [August 8, 2022, 5:20pm UTC](https://community.openastronomy.org/t/removing-labels-ticks-formatters-in-a-plot-with-wcs-projection/410/2 "2022-08-08T17:20:06Z")

</div>

Hello @Vital-Fernandez 👋

One of the oddities of WCSAxes is that it doesn’t use matplotlib to draw the ticks, it draw them itself. (This is primarily to rotate them with the coordinate grid and a few other nice things.) The upshot of this is that you can’t use the standard mpl API for turning them off, you need to use the WCSAxes specific API. You can find an example of that here: [Ticks, tick labels, and grid lines — Astropy v5.1](https://docs.astropy.org/en/stable/visualization/wcsaxes/ticks_labels_grid.html#hiding-ticks-and-tick-labels)

hope that helps!

---

<div class="post-metadata">

**Author:** ![Vital-Fernandez](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/vital-fernandez/32/245_2.png) [@Vital-Fernandez](https://community.openastronomy.org/u/Vital-Fernandez)\
**Post date:** [August 8, 2022, 7:46pm UTC](https://community.openastronomy.org/t/removing-labels-ticks-formatters-in-a-plot-with-wcs-projection/410/3 "2022-08-08T19:46:50Z")

</div>

Thank you very much! Sorry I didn’t see that😅

---

<div class="post-metadata">

**Author:** ![Cadair](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/cadair/32/422_2.png) [@Cadair](https://community.openastronomy.org/u/Cadair)\
**Post date:** [August 8, 2022, 9:06pm UTC](https://community.openastronomy.org/t/removing-labels-ticks-formatters-in-a-plot-with-wcs-projection/410/4 "2022-08-08T21:06:13Z")

</div>

Not a problem. Very easy to miss if you don’t know what you are looking for!

---

<div class="post-metadata">

**Author:** ![adamginsburg](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/adamginsburg/32/130_2.png) [@adamginsburg](https://community.openastronomy.org/u/adamginsburg)\
**Post date:** [April 7, 2025, 12:34am UTC](https://community.openastronomy.org/t/removing-labels-ticks-formatters-in-a-plot-with-wcs-projection/410/5 "2025-04-07T00:34:36Z")

</div>

How can you remove just one tick label at the edge to avoid overlap in a multipanel plot?
