A Matpltolib Axes created with projection=wcs does not play well with Matplotlib's tight_layout() method, that is supposed to re-size elements of a figure such that there are no overlapping labels/axes etc.
Consdier the following example:
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)
fig = plt.figure(figsize=(8, 6))
n = 2
for i in range(n):
projection = wcs
# projection = None
plt.subplot(n, 1, i + 1, projection=projection)
# plt.imshow(hdu.data, vmin=-2.e-5, vmax=2.e-4, origin='lower')
plt.grid(color='white', ls='solid')
plt.xlabel('Galactic Longitude')
plt.ylabel('Galactic Latitude')
plt.title('WCSAxes plot')
fig.tight_layout()
plt.show()
projection=None, no tight_layout:

projection=None, with tight_layout:

(note how this re-organises things nicely)
projection='wcs', no tight_layout:

projection='wcs', with tight_layout:

Note how things actually get worse!
- astropy 3.1.2
- Matplotlib 3.0.3
A Matpltolib
Axescreated withprojection=wcsdoes not play well with Matplotlib'stight_layout()method, that is supposed to re-size elements of a figure such that there are no overlapping labels/axes etc.Consdier the following example:
projection=None, no tight_layout:projection=None, with tight_layout:(note how this re-organises things nicely)
projection='wcs', no tight_layout:projection='wcs', with tight_layout:Note how things actually get worse!