from astropy.io import fits import matplotlib.pyplot as plt from aplpy2.angle import Angle from aplpy2.wcs_axes import WCSAxes from aplpy2.transforms.galactic import Galactic2EquatorialTransform # Create plot and axes fig = plt.figure() # Initialize axes ax1 = WCSAxes(fig, [0.1, 0.1, 0.3, 0.8], "MSX_E.fits") # Set tick spacing since no automatic method yet ax1.set_xspacing(0.2) ax1.set_yspacing(0.2) # Show image ax1.imshow(fits.getdata("MSX_E.fits"), origin="lower", cmap=plt.cm.binary, interpolation="nearest", vmax=0.0001) # Initialize axes ax2 = WCSAxes(fig, [0.6, 0.1, 0.3, 0.8], "MSX_E.fits") # Set tick spacing since no automatic method yet ax2.set_transform(ax1.transform + Galactic2EquatorialTransform(), xcoord_type="longitude", ycoord_type="latitude") ax2.set_xspacing(0.1) ax2.set_yspacing(0.1)
from astropy.io import fits import matplotlib.pyplot as plt from aplpy2.angle import Angle from aplpy2.wcs_axes import WCSAxes from aplpy2.transforms.galactic import Galactic2EquatorialTransform # Create plot and axes fig = plt.figure() # Initialize axes ax1 = WCSAxes(fig, [0.1, 0.1, 0.3, 0.8], 'MSX_E.fits') # Set tick spacing since no automatic method yet ax1.set_xspacing(0.2) ax1.set_yspacing(0.2) # Show image ax1.imshow(fits.getdata('MSX_E.fits'), origin='lower', cmap=plt.cm.binary, interpolation='nearest', vmax=0.0001) # Initialize axes ax2 = WCSAxes(fig, [0.6, 0.1, 0.3, 0.8], 'MSX_E.fits') # Set tick spacing since no automatic method yet ax2.set_transform(ax1.transform + Galactic2EquatorialTransform(),
import numpy as np import matplotlib.pyplot as plt from aplpy2.wcs_axes import WCSAxes # Create plot and axes fig = plt.figure() # Initialize axes ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8]) ax.set_xspacing(10) ax.set_yspacing(10) # Show image ax.imshow(np.random.random((128, 128))) # Save to file fig.savefig('identity.png', bbox_inches='tight')
from astropy.io import fits import matplotlib.pyplot as plt from aplpy2.angle import Angle from aplpy2.wcs_axes import WCSAxes # Create plot and axes fig = plt.figure() # Initialize axes ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], 'MSX_E.fits') # Set tick spacing since no automatic method yet ax.set_xspacing(Angle(0.2)) ax.set_yspacing(Angle(0.2, latitude=True)) # Show image ax.imshow(fits.getdata('MSX_E.fits'), origin='lower', cmap=plt.cm.binary, interpolation='nearest', vmax=0.0001) # Save to file fig.savefig('test.png', bbox_inches='tight')