<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>Thanks a lot. I was able to do what I wanted using matplotlib. Here is the code, and below the corresponding figure, if someone is interested.</div><div><br></div><div>Guillaume Blanc</div><div><br></div><div>---------------</div><div><div>import numpy as np</div><div>import pylab as pl</div><div>import math</div><div><br></div><div># the spot to plot</div><div>x = np.array([-37, 88, -137, -139, -136, -44]) # longitude</div><div>y = np.array([27, -60, -1.4, -50, -77, -46]) # latitude</div><div>lab = ['TF0.1', 'TF0.2', 'TF0.3', 'TF0.4', 'TF0.5', 'TF0.6' ]</div><div><br></div><div># To plot the celestial equator in galactic coordinates</div><div>degtorad = math.pi/180.</div><div>alpha = np.arange(-180,180.,1.)</div><div>alpha *= degtorad</div><div># From Meeus, Astronomical algorithms (with delta = 0)</div><div>x1 = np.sin(192.25*degtorad - alpha)</div><div>x2 = np.cos(192.25*degtorad - alpha)*np.sin(27.4*degtorad)</div><div>yy = np.arctan2(x1, x2)</div><div>longitude = 303*degtorad - yy </div><div>x3 = np.cos(27.4*degtorad) * np.cos(192.25*degtorad - alpha)</div><div>latitude = np.arcsin(x3)</div><div><br></div><div># We put the angles in the right direction</div><div>for i in range(0,len(alpha)):</div><div> if longitude[i] > 2.*math.pi:</div><div> longitude[i] -= 2.*math.pi</div><div> longitude[i] -= math.pi</div><div> latitude[i] = -latitude[i]</div><div><br></div><div># To avoid a line in the middle of the plot (the curve must not loop)</div><div>for i in range(0,len(longitude)-1):</div><div> if (longitude[i] * longitude[i+1] < 0 and longitude[i] > 170*degtorad and longitude[i+1] < -170.*degtorad):</div><div> indice = i</div><div> break</div><div><br></div><div># The array is put in increasing longitude </div><div>longitude2 = np.zeros(len(longitude))</div><div>latitude2 = np.zeros(len(latitude))</div><div>longitude2[0:len(longitude)-1-indice] = longitude[indice+1:len(longitude)]</div><div>longitude2[len(longitude)-indice-1:len(longitude)] = longitude[0:indice+1]</div><div>latitude2[0:len(longitude)-1-indice] = latitude[indice+1:len(longitude)]</div><div>latitude2[len(longitude)-indice-1:len(longitude)] = latitude[0:indice+1]</div><div><br></div><div>xrad = x * degtorad</div><div>yrad = y * degtorad</div><div><br></div><div>fig2 = pl.figure(2)</div><div>ax1 = fig2.add_subplot(111, projection="mollweide")</div><div><br></div><div>ax1.scatter(xrad,yrad)</div><div>ax1.plot([-math.pi, math.pi], [0,0],'r-')</div><div>ax1.plot([0,0],[-math.pi, math.pi], 'r-')</div><div><br></div><div># plot celestial equator</div><div>ax1.plot(longitude2,latitude2,'g-')</div><div><br></div><div>for i in range(0,6):</div><div> ax1.text(xrad[i], yrad[i], lab[i])</div><div><br></div><div>pl.title("Test Fields")</div><div>pl.grid(True)</div><div><br></div><div>pl.show()</div></div><div>------------</div><div><br></div><div><img id="55b801ca-2fd8-4151-9ff2-59730d3d7a85" height="600" width="800" apple-width="yes" apple-height="yes" src="cid:2B757BCF-3211-4457-B603-8616367F8803"></div><div><br><div><div>Le 19 juin 2013 à 19:10, Kelle Cruz <<a href="mailto:kellecruz@gmail.com">kellecruz@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">this is also included in one of the tutorials Adrian and I worked on:<div><a href="https://github.com/astropy/astropy-tutorials/blob/master/tutorials/Plot-Catalog/plot-catalog.py">https://github.com/astropy/astropy-tutorials/blob/master/tutorials/Plot-Catalog/plot-catalog.py</a><br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 19, 2013 at 12:21 PM, Marshall Perrin <span dir="ltr"><<a href="mailto:mperrin@stsci.edu" target="_blank">mperrin@stsci.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Jun 19, 2013, at 11:50 AM, Guillaume Blanc wrote:<br>
> I'm looking in a python library to plot a mollweide projection of the celestial sphere with some points and lines between two points... I tried using healpy, but the projplot function doesn't work well, and the plotting options look limited (well, it's not the main goal of that library, actually).<br>
><br>
> To try to be clearer, I'd like to plot some objects in a projection of the celestial sphere in galactic coordinates with the standard mollweide projection, and plot as well some "lines" such as the celestial equator and so on...<br>
><br>
> I'm sure something exist somewhere to do that!<br>
<br>
<br>
</div>This can actually all be done in plain matplotlib, just by setting the 'projection' keyword when setting up the plot axes.<br>
<br>
See <a href="http://matplotlib.org/examples/pylab_examples/geo_demo.html" target="_blank">http://matplotlib.org/examples/pylab_examples/geo_demo.html</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
- Marshall<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/astropy" target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Kelle Cruz, PhD — <a href="http://kellecruz.com/" target="_blank">http://kellecruz.com/</a><div>917.725.1334 — Hunter: x16486 — AMNH: x3404</div>
</div>
</blockquote></div><br></div></body></html>