-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
Trying to use WCSAxes with the latest main branch of Matplotlib (231d1c83f8b16e11580436ed19349dca368ea92f as of writing) is broken with the following traceback:
Traceback (most recent call last):
File "/Users/dstansby/github/matplotlib/test.py", line 12, in <module>
plt.subplot(projection=wcs)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/pyplot.py", line 1277, in subplot
ax = fig.add_subplot(*args, **kwargs)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/figure.py", line 745, in add_subplot
ax = projection_class(self, *args, **pkw)
TypeError: WCSAxes.__init__() got multiple values for argument 'wcs'Code to reproduce below. I'm not sure whether this is something that needs fixing with astropy or Matplotlib and don't have time to look into it now, but thought I'd open for info!
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)
plt.subplot(projection=wcs)
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')