Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
Close
From: Viraj Vajratkar <viraj.v87@gm...>  20070630 20:44:07
Attachments:
Message as HTML

hello ppl, hey i hav 3 .dat files... one has 1 column of x coords, another has 1 column of the same number of y coords and the last .dat file has the same number of corresponding values of a property[temperature] at those points in 1 column.... i was wondering how i cud make a contour of this data with the last .dat file being the zvalues... i hav written the following code( saf2.py)[mind u ppl am a newbie @ python+matplotlib]... from pylab import * x = load('xcord2.dat') y = load('ycord2.dat') X, Y = meshgrid(x, y) Z = load('output1im.dat') contour(X,Y,Z) show() the following errors crop up: Traceback (most recent call last): File "F:\Python25\saf2.py", line 9, in <module> contour(X,Y,Z) File "F:\Python25\Lib\sitepackages\matplotlib\pylab.py", line 1776, in contour ret = gca().contour(*args, **kwargs) File "F:\Python25\Lib\sitepackages\matplotlib\axes.py", line 4674, in contour return ContourSet(self, *args, **kwargs) File "F:\Python25\Lib\sitepackages\matplotlib\contour.py", line 429, in __init__ x, y, z = self._contour_args(*args) # also sets self.levels, File "F:\Python25\Lib\sitepackages\matplotlib\contour.py", line 601, in _contour_args x,y,z = self._check_xyz(args[:3]) File "F:\Python25\Lib\sitepackages\matplotlib\contour.py", line 577, in _check_xyz raise TypeError("Input z must be a 2D array.") TypeError: Input z must be a 2D array. wat errors am i making? 
From: Michael Newman <michael.newman@gm...>  20070703 09:55:16

My understanding is the "contour" method only handles plots of functions, e.g. f(x,y) = z, and not discrete points. I tried looking into this weeks ago, and couldn't find a way to handle discrete points. I'd love to be able to do Kriging or Inverse Distance Weighting contour lines on XY points I have of pollution concentrations at various monitors... 
From: Jeff Whitaker <jswhit@fa...>  20070703 11:59:15

Michael Newman wrote: > My understanding is the "contour" method only handles plots of > functions, e.g. f(x,y) = z, and not discrete points. I tried looking > into this weeks ago, and couldn't find a way to handle discrete points. > > I'd love to be able to do Kriging or Inverse Distance Weighting contour > lines on XY points I have of pollution concentrations at various monitors... > > Michael: There are three different methods for doing this described at http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data Jeff  Jeffrey S. Whitaker Phone : (303)4976313 NOAA/OAR/CDC R/PSD1 FAX : (303)4976449 325 Broadway Boulder, CO, USA 803053328 
From: Viraj Vajratkar <viraj.v87@gm...>  20070707 12:50:55
Attachments:
Message as HTML

On 7/3/07, Jeff Whitaker <jswhit@...> wrote: > > Michael Newman wrote: > > My understanding is the "contour" method only handles plots of > > functions, e.g. f(x,y) = z, and not discrete points. I tried looking > > into this weeks ago, and couldn't find a way to handle discrete points. > > > > I'd love to be able to do Kriging or Inverse Distance Weighting contour > > lines on XY points I have of pollution concentrations at various > monitors... > > > > > Michael: There are three different methods for doing this described at > > http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data > > Jeff > >  > Jeffrey S. Whitaker Phone : (303)4976313 > NOAA/OAR/CDC R/PSD1 FAX : (303)4976449 > 325 Broadway Boulder, CO, USA 803053328 > > >  > 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/ > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > hey guys... i got it... u can use contour(x,y,z)... as in x=load(' urfile1.dat'), y=load('urfile2.dat), z=load('urfile3.dat').... and then type out the above.... for details about the parameters x,y,z see... . http://www.scilab.org/product/maneng/graphics/contour.htm .... so matplotlib CAN plot a contour from discrete points!!!.... ive tried it and it works... 
From: Jeff Whitaker <jswhit@fa...>  20070707 13:40:55

Viraj Vajratkar wrote: > > > On 7/3/07, *Jeff Whitaker* <jswhit@... > <mailto:jswhit@...>> wrote: > > Michael Newman wrote: > > My understanding is the "contour" method only handles plots of > > functions, e.g. f(x,y) = z, and not discrete points. I tried looking > > into this weeks ago, and couldn't find a way to handle discrete > points. > > > > I'd love to be able to do Kriging or Inverse Distance Weighting > contour > > lines on XY points I have of pollution concentrations at various > monitors... > > > > > Michael: There are three different methods for doing this > described at > > http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data > > Jeff > >  > Jeffrey S. Whitaker Phone : (303)4976313 > NOAA/OAR/CDC R/PSD1 FAX : (303)4976449 > 325 Broadway Boulder, CO, USA 803053328 > > >  > 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/ > <http://sourceforge.net/powerbar/db2/>; > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > <mailto:Matplotlibusers@...> > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > hey guys... i got it... u can use contour(x,y,z)... as in > x=load('urfile1.dat'), y=load('urfile2.dat), z=load('urfile3.dat > ').... and then type out the above.... for details about the > parameters x,y,z see... . > http://www.scilab.org/product/maneng/graphics/contour.htm .... so > matplotlib CAN plot a contour from discrete points!!!.... ive tried it > and it works... Viraj: That only works because x and y describe a rectangular grid. If x and y described irregularly spaced points, you would need to grid the data first using one of the methods described on that Cookbook page. Jeff  Jeffrey S. Whitaker Phone : (303)4976313 NOAA/OAR/CDC R/PSD1 FAX : (303)4976449 325 Broadway Boulder, CO, USA 803053328 