Plotting Surfaces with GnuPlot-Python??
Prem Rachakonda
prem at engr.uky.edu
Tue Jun 5 16:28:17 EDT 2001
Hi,
I have a problem in plotting contours/surfaces. The problem
description is as follows:
x--->
y z1-1 z1-2 z1-3 z1-4 z1-5.......z1-5000
| z2-1 z2-2 z2-3 z2-4 ...
| z3-1 z3-2 z3-3 z3-4 ...
V ...
...
.
.
z100-1.........................z100-5000
I have the above matrix z of size [100,5000], each value representing
the height in z-axis(5000 points in x multiplied by 100 scans in y)
I have three matrices now, x[5000], and y[100] and z[100,5000]
And I would like to plot the contour(surface) with this x,y,z data.
My python code goes like this:(Only a part of it is displayed here)
***************************************************
scalex=1.2
scaley=2.4
scalez=3.6
size=100
g=Gnuplot.Gnuplot()
g.clear()
g.("set view 90,0")
#The function 'dlmread' reads the matrix from a number of files(set by
'size' and the z will have the number of rows=size and the number of
columns='5000'
z=reshape((array(iotools.dlmread('Folder_1','data.txt',size,100,5100))*scalez),(5000,size))
x=(arange(0.,7800))*scalex
y=(arange(0,size))*scaley
g('set parametric')
g('set data style dots')
g('set contour base')
g.splot(Gnuplot.GridData(z,x,y, binary=0))
***************************************************
If is set 'size=1', ie. try to plot only one set of values to get the
profile of the surface, I get it absolutely right, but only a
profile..not the surface.
If I set size=2, ie. try to plot two sets of values, I get 4 plots of
the profile and the every value in x is halved.
If I set size=3, then I get 9 plots and x is reduced to 1/3rd
I am not sure I understood how 'splot' plots the surface.
Please let me know if there is a way to solve this problem. Why does
the data gets scaled down???
More information about the Python-list
mailing list