Hi, how can plot this example data:
import sunpy.map
import sunpy.data.sample
import astropy.units as u
sunpy.data.sample.AIA_171_IMAGE
my_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(projection=my_map)
my_map.plot(axes=ax, clip_interval=(1, 99.5)*u.percent)
plt.colorbar()
plt.show()
The coordinates for default are:<Helioprojective Frame (obstime=2011-06-07T06:33:02.880, rsun=696000.0 km, observer=<HeliographicStonyhurst Coordinate (obstime=2011-06-07T06:33:02.880, rsun=696000.0 km): (lon, lat, radius) in (deg, deg, m)
(-0.00406429, 0.04787238, 1.51846026e+11)>)>
The cuestion is that I want plot this in “Pixels coordinates” and “kilometers”. How I can make this?
Hello @Lalokura,
If you want to plot only pixels coordinates, I think the simplest way is to just use matplotlib directly and plot the map data array using imshow.
I am not personally aware of turning WCSAxes off to do that, but there are more knowledgeable people that might chime in.
For changing the units, you can change the units for the axes by following Controlling Axes — Astropy v6.1.3
I think if you try km, it errors since they are not convertible out of the box.
You can get around this with Equivalencies — Astropy v6.1.3
# I forgot what the conversion factor is for 1 arcsec to km is so I picked a number.
arcsec_to_km = [(u.arcsec, u.km, lambda x: (x * 725)*u.km, lambda x: (x / 725)*u.arcsec)]
Then you can try to apply it via:
with u.set_enabled_equivalencies(equivalencies=arcsec_to_km):
but I am not sure if this will work.
1 Like