Re: [Matplotlib-users] plotting points/locations from data file

2011-04-20 Thread Michael Rawlins
These commands plot points on a map in my code using python, matplotlib, and basemap.  Thanks to Ian and Glenn for their assistance.  Turns out lat, lon needed to be transformed into Lambert's coordinate space upon which the rest of the map is based. If anyone knows of a more elegant way to wor

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-20 Thread Heiko Bauke
Hi, On Tue, 19 Apr 2011 13:09:23 -0700 (PDT) Michael Rawlins wrote: > I'm reading > the latitudes and longitudes from a file, with each lat, lon pair on > each record (line). I use loadtxt for this purpose. http://www.scipy.org/Cookbook/InputOutput http://www.neuralwiki.org/index.php?title=Lo

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Michael Rawlins
ted in the plot command and paste them into the source code.  Not ideal but will get the job done. Mike --- On Tue, 4/19/11, G Jones wrote: From: G Jones Subject: Re: [Matplotlib-users] plotting points/locations from data file To: "Michael Rawlins" Cc: "Ian Bell" , Matplotl

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread G Jones
(lats,lons,'*') > > #plt.plot(lons,lats,'*') > > #data = csv2rec('file2.txt',delimiter=',') > > #plot(data[:,0],data[:,1],'o') > > #data = csv2rec('file2.txt',delimiter=' ',names=['lat','lo

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Michael Rawlins
On second thought, the code requires basemap package too. Mike  --- On Tue, 4/19/11, Michael Rawlins wrote: From: Michael Rawlins Subject: Re: [Matplotlib-users] plotting points/locations from data file To: "G Jones" Cc: Matplotlib-users@lists.sourceforge.net Date: Tuesday, Apri

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Michael Rawlins
,43.0) text(xpt,ypt,'*') # draw coastlines and political boundaries. m.drawcoastlines() m.drawcountries() m.drawstates() # draw parallels and meridians. # label on left, right and bottom of map. m.drawparallels(parallels,labels=[1,0,0,0]) m.drawmeridians(meridians,labels=[1,1,0,1])    

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread G Jones
f file to use csv2rec? > > > import sys,getopt > > from mpl_toolkits.basemap import Basemap, shiftgrid, cm > from mpl_toolkits.basemap import NetCDFFile > from pylab import * > > > > > --- On *Tue, 4/19/11, Ian Bell * wrote: > > > From: Ian Bell > Subj

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Michael Rawlins
i].  I corrected that and changed my longitudes to not have the '-' sign and the code ran without error. Could the '-' be causing a problem?  I need to input the lat, lon as in the file as shown above. Mike --- On Tue, 4/19/11, Ian Bell wrote: From: Ian Bell

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Michael Rawlins
t,'*') I will strip the code down to bare minimum (take out reading of netCDF data file) and paste it here along with ten example lats,lons. --- On Tue, 4/19/11, Ian Bell wrote: From: Ian Bell Subject: Re: [Matplotlib-users] plotting points/locations from data file To: "Michael

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Ian Bell
have the '-' sign and the >> code ran without error. Could the '-' be causing a problem? I need to input >> the lat, lon as in the file as shown above. >> >> Mike >> >> >> --- On *Tue, 4/19/11, Ian Bell * wrote: >> >> >>

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Ian Bell
;-' be causing a problem? I need to input > the lat, lon as in the file as shown above. > > Mike > > > --- On *Tue, 4/19/11, Ian Bell * wrote: > > > From: Ian Bell > Subject: Re: [Matplotlib-users] plotting points/locations from data file > To: "Michael Raw

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread G Jones
to not have the '-' sign and the > code ran without error. Could the '-' be causing a problem? I need to input > the lat, lon as in the file as shown above. > > Mike > > > --- On *Tue, 4/19/11, Ian Bell * wrote: > > > From: Ian Bell >

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Michael Rawlins
ted. Traceback (most recent call last):   File "test.py", line 319, in     (lat,lon)=line.strip().split(' ') ValueError: too many values to unpack There are 203 records in the data file.  Line 319 of test.py is this: (lat,lon)=line.strip().split(' ') ---

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Ian Bell
test.py", line 319, in > > (lat,lon)=line.strip().split(' ') > ValueError: too many values to unpack > > > There are 203 records in the data file. Line 319 of test.py is this: > > > (lat,lon)=line.strip().split(' ') > > > --- On *Tu

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Michael Rawlins
ue, 4/19/11, Ian Bell wrote: From: Ian Bell Subject: Re: [Matplotlib-users] plotting points/locations from data file To: "Michael Rawlins" Cc: Matplotlib-users@lists.sourceforge.net Date: Tuesday, April 19, 2011, 6:52 PM To clarify, you are trying to read in a set of (lat,lon) points in a

Re: [Matplotlib-users] plotting points/locations from data file

2011-04-19 Thread Ian Bell
To clarify, you are trying to read in a set of (lat,lon) points in a file that is space delimited, store the data, and then put a text marker at each point, with each point numbered in order? The critical part is that you want to use a list (or numpy array) instead of a dictionary. Something like