From: Jeremy C. <jer...@gm...> - 2007-03-15 20:30:41
|
I am trying to figure out how to plot 3D data. I began with the script " demo.py" that comes with the gnuplot-py distribution. I am only changing what function is plotted but I get the error copied at the end of this email. I am using just a minimal script (also copied below). The formula for m which is commented out does not work, but the current formula for m does work. Can someone help me understand what the problem is? Thanks, Jeremy import scipy import Gnuplot def main(): x = scipy.arange(35)/2.0 y = scipy.arange(30)/10.0-1.5 xdat = x[:,None] ydat = y[None,:] m = (scipy.sin(xdat) + 0.1*xdat) - ydat**2 # m = scipy.sin(scipy.sqrt(xdat**2+ydat**2))/scipy.sqrt(xdat**2+ydat**2) print "len(x): %s" %len(x) print "len(y): %s" %len(y) print "len(m): %s" %len(m) dat = Gnuplot.GridData(m,x,y, binary=0) Chart = Gnuplot.Gnuplot(debug=1) Chart('set pm3d') Chart('set parametric') Chart('set data style lines') Chart('set hidden') Chart('set contour base') Chart.splot(dat) main() python learnGnuplot.py len(x): 35 len(y): 30 len(m): 35 gnuplot> set terminal aqua gnuplot> set parametric gnuplot> set data style lines gnuplot> splot "/tmp/tmpf2ZHuU.gnuplot/fifo" notitle gnuplot> splot "/tmp/tmpf2ZHuU.gnuplot/fifo" notitle ^ line 0: 2 columns only possible with explicit pm3d style (line 16) Exception in thread FIFO Writer for /tmp/tmpf2ZHuU.gnuplot/fifo: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.py", line 460, in __bootstrap self.run() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Gnuplot/PlotItems.py", line 448, in run f.write(self.content) IOError: [Errno 32] Broken pipe |