hi,

You could just add a scatter point at the first x[0],y[0] of each group, maybe 
annotated with a name label ?

note, for efficiency purposes, you should label the axes outside of your loop 
(+ set the title too), you only need to do this once!

Cheers,

Thomas

**********************
Dr Thomas Lecocq 
Geologist
Royal Observatory of Belgium

- Seismology -
**********************


From: gle...@comunidad.unam.mx
To: matplotlib-users@lists.sourceforge.net
Date: Tue, 12 Feb 2013 19:47:19 +0000
Subject: [Matplotlib-users] Draw paths on map using matplotlib-basemap
















Thank you for your ideas, I leave the correct code to plot trajectories of any 
object, in my case I have drawn the trajectories of convective storms.
# --- Construimos el mapa ---
import numpy as npfrom mpl_toolkits.basemap import Basemapimport 
matplotlib.pyplot as pltfrom PIL import *fig = plt.figure(figsize=(12,12))
ax = fig.add_axes([0.1,0.1,0.8,0.8])
m = Basemap(projection='cyl', llcrnrlat=12, urcrnrlat=35,llcrnrlon=-120, 
urcrnrlon=-80, resolution='c', area_thresh=1000.)
m.bluemarble()m.drawcoastlines(linewidth=0.5)m.drawcountries(linewidth=0.5)m.drawstates(linewidth=0.5)
# --- Dibujamos paralelos y meridianos ---
m.drawparallels(np.arange(10.,35.,5.),labels=[1,0,0,1])m.drawmeridians(np.arange(-120.,-80.,5.),labels=[1,0,0,1])m.drawmapboundary(fill_color='aqua')
# --- Abrimos el archivo que contiene los datos ---
import pandas as pd
df = pd.read_csv('scm-2004.csv')for evento, group in df.groupby(['evento']):    
latitude = group.lat.values    longitude = group.lon.values    x,y = 
m(longitude, latitude)    plt.plot(x,y,'y-',linewidth=2 )    
plt.xlabel('Longitud')    plt.ylabel('Latitud')    plt.title('Trayectorias de 
Sistemas Convectivos 2004')


plt.savefig('track-2004.jpg', dpi=100)
With the above code, I get
the desired figure. 60
paths drawn on 
the map of México.


I have only one last question: how could indicate the start of each of the 
storms, someone has an idea how I can do this?











------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users                   
                  
------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to