Stefan Kueppers wrote: > Hi all, > > I am a matplotlib novice and am having problems with imported floats > generated by a Perl script using the Maxmind Geo::IP library. > > I keep getting CXX TypeErrors which I can not seem to eliminate. > Any pointers for this novice please? > > I write files that return longitude and latitude and then generate a > plot script with the data set. > > > Many Thanks! > > ____________________minimally altered example plot script_______________ > > > from matplotlib.toolkits.basemap import Basemap > import pylab as p > # set up orthographic map projection with > # perspective of satellite looking down at 50N, 100W. > # use low resolution coastlines. > # don' t plot features that are smaller than 1000 square km > map = Basemap( > projection = 'ortho', > lat_0 = 50, > lon_0 = -100, > resolution = 'c', > area_thresh = 1000. > ) > # draw coastlines, country boundaries, fill continents. > map.drawcoastlines(linewidth=0.4) > map.drawcountries(linewidth=0.2) > map.fillcontinents( color = 'coral' ) > # draw the edge of the map projection region (the projection limb) > map.drawmapboundary() > # draw lat/lon grid lines every 30 degrees. > map.drawmeridians( p . arange( 0, 360, 30 ) ) > map.drawparallels( p . arange( -90, 90, 30 ) ) > # lat/lon coordinates of five cities. > > > ##---------------------changes > #data [altered data set import from Maxmind Geo::IP lookups > lats=[-0.0000, 1096176317235200.0000, 31226649198326710000.0000, 0.0000, > 0.0000] > lons=[3.0542, 3.0423, 3.1635, 3.1523, 3.1523] > cities=['Vienna US', 'Mountain View US', 'Derby GB', 'London GB', > 'London GB'] > ##---------------------end chages > > # compute the native map projection coordinates for cities. > > > #map floats > x,y = map(lons,lats) > > > # plot filled circles at the locations of the cities. > map.plot(x,y,'bo') > > # plot the names of those five cities. > for name,xpt,ypt in zip(cities,x,y): > #p.text(xpt+50000,ypt+50000,name) > p.text(xpt,ypt,name) > p.show() > >
Stefan: The lons and lats must be specified in degrees. I don't know what units you are getting from Geo::IP, but they sure aren't degrees. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users