Skip to content

Commit 5a0e4ad

Browse files
committed
Add wcsaxes dependency for doc builds and example.
1 parent 7b753b7 commit 5a0e4ad

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.continuous-integration/travis/setup_dependencies_common.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ then
4141
fi
4242

4343
# DOCUMENTATION DEPENDENCIES
44-
# build_sphinx needs sphinx and matplotlib (for plot_directive). Note that
45-
# this matplotlib will *not* work with py 3.x, but our sphinx build is
44+
# build_sphinx needs sphinx as well as matplotlib and wcsaxes (for plot_directive).
45+
# Note that this matplotlib will *not* work with py 3.x, but our sphinx build is
4646
# currently 2.7, so that's fine
4747
if [[ $SETUP_CMD == build_sphinx* ]]
4848
then
4949
$CONDA_INSTALL Sphinx=1.2.2 Pygments matplotlib
50+
pip install wcsaxes
5051
fi
5152

5253
# COVERAGE DEPENDENCIES

docs/install.rst

+2
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ packages:
337337
and most affiliated packages include this as a submodule in the source
338338
repository, so it does not need to be installed separately.)
339339

340+
- `WCSAxes <http://wcsaxes.readthedocs.org/en/latest/>`_
341+
340342
.. note::
341343

342344
Sphinx also requires a reasonably modern LaTeX installation to render

docs/wcs/index.rst

+20
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,26 @@ ability to use the :class:`~astropy.wcs.WCS` to define projections in
235235
Matplotlib. More information on installing and using WCSAxes can be found `here
236236
<http://wcsaxes.readthedocs.org>`__.
237237

238+
.. plot::
239+
:include-source:
240+
241+
from matplotlib import rcParams, pyplot as plt
242+
from astropy.io import fits
243+
from astropy.wcs import WCS
244+
from astropy.utils.data import download_file
245+
246+
fits_file = 'http://data.astropy.org/tutorials/FITS-images/HorseHead.fits'
247+
image_file = download_file(fits_file, cache=True )
248+
hdu = fits.open(image_file)[0]
249+
wcs = WCS(hdu.header)
250+
251+
fig = plt.figure()
252+
fig.add_subplot(111, projection=wcs)
253+
plt.imshow(hdu.data, origin='lower', cmap='cubehelix')
254+
plt.xlabel('RA')
255+
plt.ylabel('Dec')
256+
plt.show()
257+
238258
Other information
239259
=================
240260

0 commit comments

Comments
 (0)