Thanks Robert, it's exactly what I needed. It was so easy for you, I guess.
:o) On Nov 9, 12:28 am, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Nov 8, 2008, at 7:52 PM, acardh wrote: > > > Hi, > > Plotting an sphere is straightforward but I need help in how to draw > > points on the sphere. The sphere will represent the Earth and the > > points will be some geo-coordinates . > > > Thanks!!! > > This depends on how your points are given. I'm going to assume you > have latitude/longitude (in degrees), called phi and theta > respectively. Then one would draw the sphere via > > sage: world = sphere((0,0,0), radius=1, color='blue') > > Here I'm making 100 random cities. > sage: cities = [(ZZ.random_element(-180,180), ZZ.random_element > (-90,90)) for _ in range(100)] > > Now I'll convert polar coordinates to regular xyz coordinates. > sage: t = RDF(pi/180) > sage: city_coords = [(cos(t*theta)*cos(t*phi), sin(t*theta)*cos > (t*phi), sin(t*phi)) for theta, phi in cities] > > Now I'll plot them > sage: world + sum([point3d(v, color='red') for v in city_coords]) > > I could have, of course, done something more interesting than "points" > sage: world + sum([tetrahedron(size=.1, color='yellow').translate(v) > for v in city_coords]) > > - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---