Skip to content

Commit

Permalink
Merge 1a57956 into b1ba3c2
Browse files Browse the repository at this point in the history
  • Loading branch information
dkirkby committed Oct 18, 2018
2 parents b1ba3c2 + 1a57956 commit 007f0cf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Change Log
1.9.15 (unreleased)
-------------------

* No changes yet.
* Draw ecliptic in all-sky plots.

1.9.14 (2018-10-05)
-------------------
Expand Down
20 changes: 17 additions & 3 deletions py/desiutil/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def get_clip(value):


def init_sky(projection='eck4', ra_center=120, galactic_plane_color='red',
ra_labels=np.arange(0, 360, 60),
ecliptic_color='red', ra_labels=np.arange(0, 360, 60),
dec_labels=np.arange(-60, 90, 30), ax=None):
"""Initialize a basemap projection of the full sky.
Expand Down Expand Up @@ -361,7 +361,10 @@ def init_sky(projection='eck4', ra_center=120, galactic_plane_color='red',
Map is centered at this RA in degrees. Default is +120, which
avoids splitting the DESI northern and southern regions.
galactic_plane_color : color name or None
Draw a line representing the galactic plane using the specified
Draw a curve representing the galactic plane using the specified
color, or do nothing when None.
ecliptic_color : color name or None
Draw a dotted curve representing the ecliptic plane using the specified
color, or do nothing when None.
ra_labels : iterable or None
List of RA values in degrees that will be labeled on the map.
Expand All @@ -384,7 +387,7 @@ def init_sky(projection='eck4', ra_center=120, galactic_plane_color='red',
from matplotlib.patches import Polygon
from mpl_toolkits.basemap import pyproj
from mpl_toolkits.basemap import Basemap
from astropy.coordinates import SkyCoord
from astropy.coordinates import SkyCoord, HeliocentricTrueEcliptic, ICRS
import astropy.units as u

# Define a Basemap subclass with an ellipse() method.
Expand Down Expand Up @@ -490,6 +493,17 @@ def ellipse(self, x0, y0, a, b, n, ax=None, **kwargs):
# Make sure the galactic plane stays above other displayed objects.
paths.set_zorder(20)

# Draw the optional ecliptic plane.
if ecliptic_color is not None:
lon = np.linspace(0, 2 * np.pi, 50) * u.rad
ecliptic = HeliocentricTrueEcliptic(
lon=lon, lat=0 * u.radian, distance=1 * u.Mpc).transform_to(ICRS)
ecliptic_x, ecliptic_y = m(ecliptic.ra.degree, ecliptic.dec.degree)
paths = m.scatter(
ecliptic_x, ecliptic_y, marker='.', s=20, lw=0, alpha=0.75,
c=ecliptic_color)
paths.set_zorder(20)

return m


Expand Down

0 comments on commit 007f0cf

Please sign in to comment.