astropy/astropy — pull request #3183 by astrofrog (2014-12-07 10:57:40+00:00)
Title: WCSAxes compatibility hook

This simple change adds ``WCSAxes`` as an optional dependency for the Astropy core package.

I was trying to think about how we could get ``WCSAxes`` into astropy core in time for 1.0 and I don't want to rush it (there are a number of issues to figure out re: testing for example). But then it hit me - provided the ``WCS`` object does the right thing and implements ``_as_mpl_axes``, one never needs to import ``wcsaxes`` explicitly. With this simple change, users can now do:

```python
from astropy.wcs import WCS
import matplotlib.pyplot as plt

wcs = WCS('filename.fits')

fig = plt.figure()
ax = fig.add_axes([0.15, 0.1, 0.8, 0.8], projection=wcs)
...
```

and everything will work as expected. The advantage of this compared to merging all the WCSAxes code base in to Astropy now is that:

* We can maintain a faster development cycle
* Minimal changes to astropy core and no need to worry about large binary diffs from test images
* All the code that users will write once this is merged will continue to work seamlessly if we merge WCSAxes into the core package

The only downside is that users have to install ``WCSAxes`` separately if they want that functionality.

So essentially what this is doing is treating ``WCSAxes`` as a plug-in for now. I think this is a nice compromise between merging all of WCSAxes into the core package *now* and not doing anything.

cc @eteq @Cadair @cdeil @anizami