import astropy.units as u
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from pylab import figure
from astropy.coordinates import SkyCoord
import sunpy.map
from sunpy.data.sample import AIA_171_IMAGE
aiamap = sunpy.map.Map(AIA_171_IMAGE)
bl = SkyCoord(-400*u.arcsec, -900*u.arcsec, frame=aiamap.coordinate_frame)
tr = SkyCoord(800*u.arcsec, 700*u.arcsec, frame=aiamap.coordinate_frame)
ams = aiamap.submap(bl,tr)
ams.plot_settings['norm'] = LogNorm(1e2, 1e4)
fig = plt.figure(figsize=(9, 8))
ax = plt.subplot(projection=ams)
ams.plot()
ams.draw_limb(color='black',linewidth=2,linestyle='dashed')
ams.draw_grid(color='blue',linewidth=2,linestyle='dotted')
title_obsdate='{:.20}'.format('{:%Y-%b-%d %H:%M:%s}'.format(ams.date))
ax.set_title('AIA 171$\AA$ '+ title_obsdate)
ax.set_ylabel('y [arcsec]')
ax.set_xlabel('x [arcsec]')
plt.colorbar(fraction=0.035, pad=0.03,label='DN')
plt.show()
--
You received this message because you are subscribed to the Google Groups "SunPy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sunpy+unsubscribe@googlegroups.com.
To post to this group, send email to su...@googlegroups.com.
Visit this group at https://groups.google.com/group/sunpy.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to sunpy+un...@googlegroups.com.
Hi Iain,
Thanks for the email, it's highlighted that there are a couple of tweaks that should be made to the plotting functions / docs to make it easier to get simpler plots out.
To answer your question you want to setup the heliographic grid manually, so replace the `ams.draw_grid` with the following:
# Manually plot a heliographic overlay.
overlay =
ax.get_coords_overlay('heliographic_stonyhurst')
lon = overlay[0]
lat = overlay[1]
lon.set_ticks_visible(False)
lat.set_ticks_visible(False)
lat.set_ticklabel_visible(False)
lon.set_ticklabel_visible(False)
lon.coord_wrap = 180
lon.set_major_formatter('dd')
overlay.grid(color='blue', linewidth=2,
linestyle='dashed')
I was *just* about to send this along too... thanks Stuart!
Even with no_ticks options in map.draw_grid, this would make the
basis of a good example in the Example gallery on how to get fine
grained control on the grid properties.
Hi,
You can do this using WCSAxes as described here:
http://docs.astropy.org/en/stable/visualization/wcsaxes/ticks_labels_grid.html#tick-label-format
setting the format to 's' should do it:
tx, ty = ax.coords
tx.set_major_formatter('s')
ty.set_major_formatter('s')