Skip to content

Instantly share code, notes, and snippets.

@astrofrog
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrofrog/9507255 to your computer and use it in GitHub Desktop.
Save astrofrog/9507255 to your computer and use it in GitHub Desktop.
import pyavm
from matplotlib import pyplot as plt
from wcsaxes import WCS
from PIL import Image
avm = pyavm.AVM.from_image('gcenter.jpg')
wcs = avm.to_wcs(target_image='gcenter.jpg')
fig = plt.figure()
ax = WCSAxes(fig, [0.075, 0.1, 0.8, 0.8], wcs=wcs)
fig.add_axes(ax)
img = Image.open('gcenter.jpg')
img = img.transpose(Image.FLIP_TOP_BOTTOM)
coords = ax.get_coords_overlay('galactic')
coords.grid(color='orange', alpha=0.2)
ax.imshow(img, origin='lower')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment