Last active
April 19, 2021 21:16
-
-
Save dstansby/7d1d891f6e1d6dd928dbc43a716340dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import astropy.units as u | |
from astropy.coordinates import SkyCoord | |
from matplotlib.patches import Rectangle | |
import sunpy.data.sample | |
import sunpy.map | |
aia_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) | |
# Create a rotated copy | |
aia_map_rotated = sunpy.map.Map(aia_map.data, aia_map.meta) | |
aia_map_rotated = aia_map_rotated.rotate(45 * u.deg) | |
bottom_left = SkyCoord(200 * u.arcsec, 200 * u.arcsec, | |
frame=aia_map.coordinate_frame) | |
fig = plt.figure() | |
ax1 = fig.add_subplot(2, 1, 1, projection=aia_map) | |
ax2 = fig.add_subplot(2, 1, 2, projection=aia_map_rotated) | |
aia_map.plot(axes=ax1) | |
aia_map.draw_rectangle(bottom_left, | |
width=800 * u.arcsec, | |
height=400 * u.arcsec) | |
aia_map_rotated.plot(axes=ax2) | |
aia_map_rotated.draw_rectangle(bottom_left, | |
width=800 * u.arcsec, | |
height=400 * u.arcsec) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment