%pylab inline plt.rcParams['figure.figsize'] = (10.0, 6.0) import mpl_toolkits.basemap as bm from matplotlib.mlab import csv2rec import sys print sys.version print 'numpy= ' + np.__version__ print 'matplotlib= ' + mpl.__version__ print 'basemap= ' + bm.__version__ # active world volcano spreadshethttp://www.volcano.si.edu/list_volcano_excel.cfm gvp = csv2rec('GVP_Volcano_List.csv',skiprows=1) print gvp.size, gvp.longitude, gvp.latitude # Error plotting lots of unsorted longitudes and latitudes fig,ax1 = plt.subplots() bmap = bm.Basemap(projection='cyl',resolution='c', ax=ax1) bmap.drawcoastlines() bmap.plot(gvp.longitude, gvp.latitude, 'r^', ms=4, latlon=True) # causes error: # No error with latlon=False? fig,ax1 = plt.subplots() bmap = bm.Basemap(projection='cyl',resolution='c', ax=ax1) bmap.drawcoastlines() bmap.plot(gvp.longitude, gvp.latitude, 'r^', ms=4, latlon=False) # Only half points plotted with shifted center of map fig,ax1 = plt.subplots() bmap = bm.Basemap(projection='cyl',resolution='c', lon_0=180, ax=ax1) bmap.drawcoastlines() bmap.plot(gvp.longitude, gvp.latitude, 'r^', ms=4, latlon=False) # Other half for negative 180 fig,ax1 = plt.subplots() bmap = bm.Basemap(projection='cyl',resolution='c', lon_0=-180, ax=ax1) bmap.drawcoastlines() bmap.plot(gvp.longitude, gvp.latitude, 'r^', ms=4, latlon=False) # Error again in shiftdata fig,ax1 = plt.subplots() bmap = bm.Basemap(projection='cyl',resolution='c', lon_0=180, ax=ax1) bmap.drawcoastlines() bmap.plot(gvp.longitude, gvp.latitude, 'r^', ms=4, latlon=True) # pre-sort longitude and latitude? - no error, but not plotted correctly. lons = gvp.longitude lats = gvp.latitude asc = lons.argsort() #ascending -180 to 180 lons_asc = lons[asc] #lons[asc][::-1] #descending lats_asc = lats[asc] fig,ax1 = plt.subplots() bmap = bm.Basemap(projection='cyl',resolution='c', lon_0=-180.0, ax=ax1) bmap.drawcoastlines() bmap.plot(lons_asc,lats_asc, 'r^', ms=4, latlon=True) # Explicitly transform coords in projected coordinates works fine. fig,ax1 = plt.subplots() bmap = bm.Basemap(projection='kav7',resolution='c', lon_0=180.0, ax=ax1) bmap.drawcoastlines() x,y = bmap(gvp.longitude,gvp.latitude) bmap.plot(x,y,'r^', ms=4, latlon=False)