David, The loop is you have is unnecessary. You can plot the markers and the lines at the same time like so: from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import matplotlib.lines as lines import numpy as np
m = Basemap(llcrnrlon=-11.5,llcrnrlat=51.0,urcrnrlon=-4.5,urcrnrlat=56.0, resolution='i',projection='cass',lon_0=-4.36,lat_0=54.7) lats = [53.5519317,53.8758499, 54.2894659, 55.2333142, 54.9846137,54.7064869, 51.5296651, 51.5536226, 51.7653115, 52.1625237, 52.5809163, 52.9393892] lons = [-9.9413447, -9.9621948, -8.9583439, -7.6770179, -8.3771698, -8.7406732, -8.9529546, -9.7907148, -10.1531573, -10.4099873, -9.8456417, -9.4344939] m.plot(x, y, 'D-', markersize=10, linewidth=2, color='k', markerfacecolor='b') m.drawcoastlines() plt.show() Hope that helps, -paul On Wed, Feb 29, 2012 at 4:27 AM, David Craig <dcdavem...@gmail.com> wrote: > Hi, > I'm trying to produce a map with 12 locations marked on it and straight > lines plotted between each point and all other points on the map. I have > the map with the locations ok but am having trouble getting the lines. > My code is below anyone know how to do this?? > Thanks > D > > from mpl_toolkits.basemap import Basemap > import matplotlib.pyplot as plt > import matplotlib.lines as lines > import numpy as np > > m = Basemap(llcrnrlon=-11.5,llcrnrlat=51.0,urcrnrlon=-4.5,urcrnrlat=56.0, > resolution='i',projection='cass',lon_0=-4.36,lat_0=54.7) > > lats = [53.5519317,53.8758499, 54.2894659, 55.2333142, > 54.9846137,54.7064869, 51.5296651, 51.5536226, 51.7653115, 52.1625237, > 52.5809163, 52.9393892] > > lons = [-9.9413447, -9.9621948, -8.9583439, -7.6770179, -8.3771698, > -8.7406732, -8.9529546, -9.7907148, -10.1531573, -10.4099873, > -9.8456417, -9.4344939] > > x, y = m(lons, lats) > for i in range(len(lons)): > for j in range(len(lons)): > if i == j: continue > m.plot([x[i],y[i]],[x[j],y[j]],'k') > > m.plot(x, y, 'bD', markersize=10) > m.drawcoastlines() > #m.drawmapboundary() > #plt.savefig('/media/A677-86E0/dot_size'+str(i)+'.png') > plt.show() > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users