Note
Go to the end to download the full example code.
Drawing the Extent of a WCS#
This example demonstrates how to draw the extent of a WCS on a Map
import matplotlib.pyplot as plt
import astropy.units as u
from astropy.coordinates import SkyCoord
import sunpy.data.sample
import sunpy.map
import sunpy.visualization.drawing
First, load an AIA map and create a submap around a band of active regions.

To show the context of the submap, we can draw the extent of the submap on top of the full-disk map.
fig = plt.figure()
ax = fig.add_subplot(projection=m_aia)
m_aia.plot(axes=ax)
m_aia_sub.draw_extent(axes=ax)

(<matplotlib.patches.Polygon object at 0x7f2a0366c6e0>, None)
Additionally, we can draw the extent of the submap on top of an EUV
observation from STEREO A which was separated from SDO by over 116 degrees.
Note that using sunpy.visualization.drawing.extent
allows for drawing the
extent of any WCS which contains two celestial axes.
m_euvi = sunpy.map.Map(sunpy.data.sample.STEREO_A_195_JUN2012)
fig = plt.figure()
ax = fig.add_subplot(projection=m_euvi)
m_euvi.plot(axes=ax)
sunpy.visualization.drawing.extent(ax, m_aia_sub.wcs)
plt.show()

INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase]
INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase]
Total running time of the script: (0 minutes 1.457 seconds)