Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Peter I. Hansen <peterih@gm...>  20070710 21:02:29

Hello I have gridded data of the shape: x_1 y_1 z_1 x_1 y_2 z_2 . . . x_1 y_N z_N x_2 y_1 z_(N+1) x_2 y_2 z_(N+2) . . . x_2 y_N z_(2N) x_M y_1 z_(MN) x_M y_2 z_(MN) . . . x_M y_N z_(MN) I've tried to follow the contour_demo script by making x = arange(M numbers) y = arange(N numbers) X,Y = meshgrid(x,y) M = load('zdata.dat') Z = reshape(M, (M,N)) figure() CS = contour(X,Y,Z) But I get errors that x and y are not 1D or 2D... Can someone help me to do this right? thanks, Peter 
From: Eric Firing <efiring@ha...>  20070710 23:01:21

Peter I. Hansen wrote: > Hello > > I have gridded data of the shape: > > x_1 y_1 z_1 > x_1 y_2 z_2 > . . . > x_1 y_N z_N > > x_2 y_1 z_(N+1) > x_2 y_2 z_(N+2) > . . . > x_2 y_N z_(2N) > > x_M y_1 z_(MN) > x_M y_2 z_(MN) > . . . > x_M y_N z_(MN) > > I've tried to follow the contour_demo script by making You don't need to make your own X, Y, so delete the following 3 lines. > > x = arange(M numbers) > y = arange(N numbers) > X,Y = meshgrid(x,y) > > M = load('zdata.dat') Now you have X, Y, and Z, each as a column in your file, so you need to split them apart and reshape them. Let's assume M, N are the number of X and Y values in your grid; to avoid name confusion, change the load to XYZ = load('zdata.dat') X = XYZ[:,0] X.shape = (M,N) Y = XYZ[:,1] Y.shape = (M,N) Z = XYZ[:,2] Z.shape = (M,N) CS = contour(X.transpose(), Y.transpose(), Z.transpose()) The reason for all the transposing is that pcolor and contour display images with column number increasing with X, and row number increasing with Y. Since you have M Xvalues and N Yvalues, everything has to end up N by M, not the reverse. Eric > > Z = reshape(M, (M,N)) > > figure() > CS = contour(X,Y,Z) > > But I get errors that x and y are not 1D or 2D... Can someone help me > to do this right? > thanks, Peter > >  > 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 
From: Peter I. Hansen <peterih@gm...>  20070710 23:22:10

On 7/11/07, Eric Firing <efiring@...> wrote: > Peter I. Hansen wrote: > > Hello > > > > I have gridded data of the shape: > > > > x_1 y_1 z_1 > > x_1 y_2 z_2 > > . . . > > x_1 y_N z_N > > > > x_2 y_1 z_(N+1) > > x_2 y_2 z_(N+2) > > . . . > > x_2 y_N z_(2N) > > > > x_M y_1 z_(MN) > > x_M y_2 z_(MN) > > . . . > > x_M y_N z_(MN) > > > > I've tried to follow the contour_demo script by making > > > You don't need to make your own X, Y, so delete the following 3 lines. > > > > x = arange(M numbers) > > y = arange(N numbers) > > X,Y = meshgrid(x,y) > > > > M = load('zdata.dat') > > Now you have X, Y, and Z, each as a column in your file, so you need to > split them apart and reshape them. Let's assume M, N are the number of > X and Y values in your grid; to avoid name confusion, change the load to > > XYZ = load('zdata.dat') > > X = XYZ[:,0] > X.shape = (M,N) > Y = XYZ[:,1] > Y.shape = (M,N) > Z = XYZ[:,2] > Z.shape = (M,N) > > CS = contour(X.transpose(), Y.transpose(), Z.transpose()) > > The reason for all the transposing is that pcolor and contour display > images with column number increasing with X, and row number increasing > with Y. Since you have M Xvalues and N Yvalues, everything has to end > up N by M, not the reverse. Perfect. That was just what i needed to know. Thanks! 
Sign up for the SourceForge newsletter:
No, thanks