[Matplotlib-users] Customizing 3d plots

2011-04-19 Thread José Alexandre Nalon
Greetings, I'm trying to use Matplotlib to plot 3d surfaces, with good results. While the plot are nice, there is little information on the website about customizing them. To get what I want, I used some tricks and hacks, and I am pretty sure that there are better ways to do it. Here is what I did

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

2011-04-19 Thread Michael Rawlins
Thanks Glenn and Ian.  I have just explicitly set delimiter=',' but still no points plotted.  I'm new to this software so will look into using ipython --pylab and documentation.  For the short term I will just create in a shell script 200 strings/records with the lat,lon inserted in the plot co

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

2011-04-19 Thread G Jones
As you can see from the error message, it's trying to convert "39.4670," to a float and complaining that this is not a valid value (because of the comma. The examples I suggested were for your original space delimited data. For comma delimited data you'll want to remove the delimiter argument to cs

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, April 19, 2011, 8

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

2011-04-19 Thread Michael Rawlins
The first example produced no plotted symbols but no errors on execution.  The second example produced this: Plotting, please wait...maybe more than 10 seconds Traceback (most recent call last):   File "testNew.py", line 137, in     data = np.loadtxt('file2.txt')   File "/usr/lib/python2.6/dist

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

2011-04-19 Thread G Jones
No need for a header, but I guess my example was a little too simple. You could do: data = csv2rec(filename,delimiter=' ',names=['lat','lon']) plot(data['lat'],data['lon'],'o') or you could do data = np.loadtxt(filename) plot(data[:,0],data[:,1],'o') In general, I strongly recommend developing wi

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

2011-04-19 Thread Michael Rawlins
Do I need to add something to the header(?) at top of 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 Subject: Re: [Matplo

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

2011-04-19 Thread Michael Rawlins
I've set up the data file with comma delimiter and one space.  Split command now: (lat,lon)=line.strip().split(',') Code runs without error but no points on the map.  These two lines, however, do produce an asterisk at the proper location: xpt,ypt = m(-75.0,43.0) text(xpt,ypt,'*') I will st

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

2011-04-19 Thread Ian Bell
Have to say I whole-heartedly agree with Glenn. One problem I have run into is a funky file headers where I want to skip lines 1,2,3, and 4, but line 3 is my real header line which doesn't work so well with either of the below solutions. I had to write my own wrapper to deal with these weird type

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

2011-04-19 Thread Ian Bell
The easiest solution would be to put a comma as the delimiter between the lat and lon, and then change split(' ') to split(','). Then everything should work fine. I exclusively work with comma separated files for this exact reason. You are right that I had a typo, it should be lons[i]. It looks

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

2011-04-19 Thread G Jones
You may find it easier to use mlab.csv2rec or numpy.loadtxt. e.g. data = csv2rec(filename,delimiter=' ') plot(data[:,0],data[:,1],'o') On Tue, Apr 19, 2011 at 4:26 PM, Michael Rawlins wrote: > > Sorry I should have mentioned that longitudes are negative; there is a '-' > before each longitude,

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

2011-04-19 Thread Michael Rawlins
Sorry I should have mentioned that longitudes are negative; there is a '-' before each longitude, like so: 39.4670  -76.1670 46.4000  -74.7670 45.3830  -75.7170 43.6170  -79.3830 45.5170  -73.4170 Also the plt.text line you sent had lon[i] rather than lons[i].  I corrected that and chang

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

2011-04-19 Thread Ian Bell
If you want to plot a given marker at the point, for instance a circle, replace the last line of my code plt.text.. with plt.plot(lats,lons,'o') for a circle, or plt.plot(lats,lons,'s') for a square. Refer to Plot

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

2011-04-19 Thread Michael Rawlins
Yes, there is whitespace between each lat and lon on each line.  But, actually, I'd simply like to plot a dot at each location.  The '1' was there in my example because I do not yet know how to plot a particular symbol.  Here is what I got when I tried the code you just suggested. Traceback (

Re: [Matplotlib-users] Pixel shape

2011-04-19 Thread Paolo Zaffino
I have resolved using the aspect setting. I calculated the ratio between the two pixel dimensions and I use this value for aspect (if you want to shift the pixel size you can use the inverse of this value). Thank you for the support! Paolo Il 18/04/2011 15:55, Joe Kington ha scritto: Actually

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

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

2011-04-19 Thread Michael Rawlins
I'm trying to plot a series of points/locations on a map. I'm reading the latitudes and longitudes from a file, with each lat, lon pair on each record (line). Here is the code: def make_float(line): lati, longi = line.split() return float(lati), float(longi) my_dict = {} with open("fi

Re: [Matplotlib-users] Possible memory leak?

2011-04-19 Thread Michael Droettboom
Ok. I have a RHEL5 Linux box with Python 2.7.1. With Numpy 1.4.1 and 1.5.1 I don't see any leaks. With Numpy git HEAD, I did see a leak -- I submitted a pull request to Numpy here: https://github.com/numpy/numpy/pull/76 I get the same results (no leaks) running your wx, tk and agg scripts

Re: [Matplotlib-users] Possible memory leak?

2011-04-19 Thread Caleb Constantine
On Tue, Apr 19, 2011 at 1:01 PM, Michael Droettboom wrote: > There's a lot of moving parts here.  Running your script again is > showing some leaks in valgrind that weren't there before, but a number > of the underlying libraries have changed on my system since then (memory > leaks tend to be Whac

Re: [Matplotlib-users] Possible memory leak?

2011-04-19 Thread Michael Droettboom
There's a lot of moving parts here. Running your script again is showing some leaks in valgrind that weren't there before, but a number of the underlying libraries have changed on my system since then (memory leaks tend to be Whac-a-mole sometimes...) Which versions of the following are you ru

Re: [Matplotlib-users] Possible memory leak?

2011-04-19 Thread Caleb Constantine
This picks up from a thread of the same name between 18 Nov 2010 and 22 Nov 2010. Release 1.0.1 of matplotlib has made significant gains in reducing the memory leak (thanks!!), but it did not eliminate the problem entirely. Recall, the TkAgg back-end does not have any leak, so we know this particu

Re: [Matplotlib-users] Re size the colorbar

2011-04-19 Thread Muffles
efiring wrote: > > > Have you tried using vmin=1e4 above? > > Well that did the trick...how did i miss that...thankyou! -- View this message in context: http://old.nabble.com/Resize-the-colorbar-tp31425316p31432430.html Sent from the matplotlib - users mailing list archive at Nabble.com.

Re: [Matplotlib-users] strange behavior with imshow

2011-04-19 Thread Emanuele Passera
Thank you all, using mpl from git worked fine. Problem solved. Is there a deadline for the new version release ? Emanuele Passera Software Engineer Tele-Rilevamento Europa - T.R.E. srl Via Vittoria Colonna, 7 20149 Milano – Italia Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230 emanuele.pass...@tr

Re: [Matplotlib-users] strange behavior with imshow

2011-04-19 Thread Eric Firing
On 04/18/2011 12:46 AM, Emanuele Passera wrote: > Hello everybody, > > I am experiencing a strange behavior with the imshow() function when > using the nearest interpolation method. > > Executing the code listed below, I obtain a good image when using the > bilinear interpolation method > and a tot