SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Viraj V. <vir...@gm...> - 2007年06月30日 20:44:07
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 z-values... 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\site-packages\matplotlib\pylab.py", line 1776, in
contour
 ret = gca().contour(*args, **kwargs)
 File "F:\Python25\Lib\site-packages\matplotlib\axes.py", line 4674, in
contour
 return ContourSet(self, *args, **kwargs)
 File "F:\Python25\Lib\site-packages\matplotlib\contour.py", line 429, in
__init__
 x, y, z = self._contour_args(*args) # also sets self.levels,
 File "F:\Python25\Lib\site-packages\matplotlib\contour.py", line 601, in
_contour_args
 x,y,z = self._check_xyz(args[:3])
 File "F:\Python25\Lib\site-packages\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 N. <mic...@gm...> - 2007年07月03日 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 W. <js...@fa...> - 2007年07月03日 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)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: Viraj V. <vir...@gm...> - 2007年07月07日 12:50:55
On 7/3/07, Jeff Whitaker <js...@fa...> 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)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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
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/man-eng/graphics/contour.htm .... so
matplotlib CAN plot a contour from discrete points!!!.... ive tried it and
it works...
From: Jeff W. <js...@fa...> - 2007年07月07日 13:40:55
Viraj Vajratkar wrote:
>
>
> On 7/3/07, *Jeff Whitaker* <js...@fa... 
> <mailto:js...@fa...>> 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)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/
> <http://sourceforge.net/powerbar/db2/>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 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/man-eng/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)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /