Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 165393 Details for
Bug 237626
dev-python/gnuplot-py fails to install with python-2.6
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
gnuplot-py-1.8-py26-namespace-fix.patch
gnuplot-py-1.8-py26-namespace-fix.patch (text/plain), 28.47 KB, created by
Mike Auty (RETIRED)
on 2008-09-14 12:36:31 UTC
(
hide
)
Description:
gnuplot-py-1.8-py26-namespace-fix.patch
Filename:
MIME Type:
Creator:
Mike Auty (RETIRED)
Created:
2008-09-14 12:36:31 UTC
Size:
28.47 KB
patch
obsolete
>diff --git a/README.txt b/README.txt >index b2adf33..34cd7f6 100644 >--- a/README.txt >+++ b/README.txt >@@ -45,7 +45,7 @@ gnuplot then type `help', or read it online at > > ). > >-For a relatively thorough test of Gnuplot.py, type `python test.py' >+For a relatively thorough test of Gnuplot.py, type `python test-gnuplot.py' > which goes systematically through most Gnuplot.py features. > > >diff --git a/demo.py b/demo.py >index 6e2dfbf..45dfae4 100755 >--- a/demo.py >+++ b/demo.py >@@ -9,7 +9,7 @@ > """demo.py -- Demonstrate the Gnuplot python module. > > Run this demo by typing 'python demo.py'. For a more complete test of >-the Gnuplot package, see test.py. >+the Gnuplot package, see test-gnuplot.py. > > """ > >diff --git a/doc/Gnuplot/README.html b/doc/Gnuplot/README.html >index 238d540..b10a652 100644 >--- a/doc/Gnuplot/README.html >+++ b/doc/Gnuplot/README.html >@@ -66,7 +66,7 @@ about gnuplot, for which a good source is the gnuplot help (run > gnuplot then type `help', or read it online at<p> http://www.gnuplot.info/gnuplot.html</p> > </p> > <p>).</p> >-<p>For a relatively thorough test of Gnuplot.py, type `python test.py' >+<p>For a relatively thorough test of Gnuplot.py, type `python test-gnuplot.py' > which goes systematically through most Gnuplot.py features.</p> > <p>Installation > ------------</p> >@@ -225,4 +225,4 @@ Michael Haggerty > > </body> > </html> >- >\ No newline at end of file >+ >diff --git a/doc/Gnuplot/index.html b/doc/Gnuplot/index.html >index dc7f8a5..d875273 100644 >--- a/doc/Gnuplot/index.html >+++ b/doc/Gnuplot/index.html >@@ -243,7 +243,7 @@ > </tr> > > <tr> >- <td valign="top"><p><a href="test.html">test.py</a></p></td> >+ <td valign="top"><p><a href="test.html">test-gnuplot.py</a></p></td> > <td valign="top"></td> > </tr> > >@@ -268,4 +268,4 @@ > > </body> > </html> >- >\ No newline at end of file >+ >diff --git a/doc/Gnuplot/test.html b/doc/Gnuplot/test.html >index 6450d4e..677537b 100644 >--- a/doc/Gnuplot/test.html >+++ b/doc/Gnuplot/test.html >@@ -20,14 +20,14 @@ > </th> > <th bgcolor="#88bbee" > width="90%" >- align="right"><font color="#000000">Gnuplot/test.py</font> >+ align="right"><font color="#000000">Gnuplot/test-gnuplot.py</font> > </th> > </tr> > <tr> > <td> > <!-- breadcrumbs --> > <p><small> >-/ <a href="../Gnuplot/index.html">Gnuplot</a> / test.py </small></p> >+/ <a href="../Gnuplot/index.html">Gnuplot</a> / test-gnuplot.py </small></p> > > <!-- /breadcrumbs --> > <table border="0" cellpadding="5" cellspacing="0" width="100%"> >@@ -148,4 +148,4 @@ wait ( str=None, prompt=None ) > > </body> > </html> >- >\ No newline at end of file >+ >diff --git a/test-gnuplot.py b/test-gnuplot.py >new file mode 100755 >index 0000000..6965a29 >--- /dev/null >+++ b/test-gnuplot.py >@@ -0,0 +1,336 @@ >+#! /usr/bin/env python >+ >+# $Id: test.py 302 2008-01-14 22:15:19Z bmcage $ >+ >+# Copyright (C) 1999-2003 Michael Haggerty <mhagger@alum.mit.edu> >+# >+# This file is licensed under the GNU Lesser General Public License >+# (LGPL). See LICENSE.txt for details. >+ >+"""test.py -- Exercise the Gnuplot.py module. >+ >+This module is not meant to be a flashy demonstration; rather it is a >+thorough test of many combinations of Gnuplot.py features. >+ >+""" >+ >+import os, time, math, tempfile >+import numpy >+ >+try: >+ import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils >+except ImportError: >+ # kludge in case Gnuplot hasn't been installed as a module yet: >+ import __init__ >+ Gnuplot = __init__ >+ import PlotItems >+ Gnuplot.PlotItems = PlotItems >+ import funcutils >+ Gnuplot.funcutils = funcutils >+ >+ >+def wait(str=None, prompt='Press return to show results...\n'): >+ if str is not None: >+ print str >+ raw_input(prompt) >+ >+ >+def main(): >+ """Exercise the Gnuplot module.""" >+ >+ print ( >+ 'This program exercises many of the features of Gnuplot.py. The\n' >+ 'commands that are actually sent to gnuplot are printed for your\n' >+ 'enjoyment.' >+ ) >+ >+ wait('Popping up a blank gnuplot window on your screen.') >+ g = Gnuplot.Gnuplot(debug=1) >+ g.clear() >+ >+ # Make two temporary files: >+ if hasattr(tempfile, 'mkstemp'): >+ (fd, filename1,) = tempfile.mkstemp(text=1) >+ f = os.fdopen(fd, 'w') >+ (fd, filename2,) = tempfile.mkstemp(text=1) >+ else: >+ filename1 = tempfile.mktemp() >+ f = open(filename1, 'w') >+ filename2 = tempfile.mktemp() >+ try: >+ for x in numpy.arange(100.)/5. - 10.: >+ f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x))) >+ f.close() >+ >+ print '############### test Func ###################################' >+ wait('Plot a gnuplot-generated function') >+ g.plot(Gnuplot.Func('sin(x)')) >+ >+ wait('Set title and axis labels and try replot()') >+ g.title('Title') >+ g.xlabel('x') >+ g.ylabel('y') >+ g.replot() >+ >+ wait('Style linespoints') >+ g.plot(Gnuplot.Func('sin(x)', with_='linespoints')) >+ wait('title=None') >+ g.plot(Gnuplot.Func('sin(x)', title=None)) >+ wait('title="Sine of x"') >+ g.plot(Gnuplot.Func('sin(x)', title='Sine of x')) >+ wait('axes=x2y2') >+ g.plot(Gnuplot.Func('sin(x)', axes='x2y2', title='Sine of x')) >+ >+ print 'Change Func attributes after construction:' >+ f = Gnuplot.Func('sin(x)') >+ wait('Original') >+ g.plot(f) >+ wait('Style linespoints') >+ f.set_option(with_='linespoints') >+ g.plot(f) >+ wait('title=None') >+ f.set_option(title=None) >+ g.plot(f) >+ wait('title="Sine of x"') >+ f.set_option(title='Sine of x') >+ g.plot(f) >+ wait('axes=x2y2') >+ f.set_option(axes='x2y2') >+ g.plot(f) >+ >+ print '############### test File ###################################' >+ wait('Generate a File from a filename') >+ g.plot(Gnuplot.File(filename1)) >+ >+ wait('Style lines') >+ g.plot(Gnuplot.File(filename1, with_='lines')) >+ >+ wait('using=1, using=(1,)') >+ g.plot(Gnuplot.File(filename1, using=1, with_='lines'), >+ Gnuplot.File(filename1, using=(1,), with_='points')) >+ wait('using=(1,2), using="1:3"') >+ g.plot(Gnuplot.File(filename1, using=(1,2)), >+ Gnuplot.File(filename1, using='1:3')) >+ >+ wait('every=5, every=(5,)') >+ g.plot(Gnuplot.File(filename1, every=5, with_='lines'), >+ Gnuplot.File(filename1, every=(5,), with_='points')) >+ wait('every=(10,None,0), every="10::5"') >+ g.plot(Gnuplot.File(filename1, with_='lines'), >+ Gnuplot.File(filename1, every=(10,None,0)), >+ Gnuplot.File(filename1, every='10::5')) >+ >+ wait('title=None') >+ g.plot(Gnuplot.File(filename1, title=None)) >+ wait('title="title"') >+ g.plot(Gnuplot.File(filename1, title='title')) >+ >+ print 'Change File attributes after construction:' >+ f = Gnuplot.File(filename1) >+ wait('Original') >+ g.plot(f) >+ wait('Style linespoints') >+ f.set_option(with_='linespoints') >+ g.plot(f) >+ wait('using=(1,3)') >+ f.set_option(using=(1,3)) >+ g.plot(f) >+ wait('title=None') >+ f.set_option(title=None) >+ g.plot(f) >+ >+ print '############### test Data ###################################' >+ x = numpy.arange(100)/5. - 10. >+ y1 = numpy.cos(x) >+ y2 = numpy.sin(x) >+ d = numpy.transpose((x,y1,y2)) >+ >+ wait('Plot Data against its index') >+ g.plot(Gnuplot.Data(y2, inline=0)) >+ >+ wait('Plot Data, specified column-by-column') >+ g.plot(Gnuplot.Data(x,y2, inline=0)) >+ wait('Same thing, saved to a file') >+ Gnuplot.Data(x,y2, inline=0, filename=filename1) >+ g.plot(Gnuplot.File(filename1)) >+ wait('Same thing, inline data') >+ g.plot(Gnuplot.Data(x,y2, inline=1)) >+ >+ wait('Plot Data, specified by an array') >+ g.plot(Gnuplot.Data(d, inline=0)) >+ wait('Same thing, saved to a file') >+ Gnuplot.Data(d, inline=0, filename=filename1) >+ g.plot(Gnuplot.File(filename1)) >+ wait('Same thing, inline data') >+ g.plot(Gnuplot.Data(d, inline=1)) >+ wait('with_="lp 4 4"') >+ g.plot(Gnuplot.Data(d, with_='lp 4 4')) >+ wait('cols=0') >+ g.plot(Gnuplot.Data(d, cols=0)) >+ wait('cols=(0,1), cols=(0,2)') >+ g.plot(Gnuplot.Data(d, cols=(0,1), inline=0), >+ Gnuplot.Data(d, cols=(0,2), inline=0)) >+ wait('Same thing, saved to files') >+ Gnuplot.Data(d, cols=(0,1), inline=0, filename=filename1) >+ Gnuplot.Data(d, cols=(0,2), inline=0, filename=filename2) >+ g.plot(Gnuplot.File(filename1), Gnuplot.File(filename2)) >+ wait('Same thing, inline data') >+ g.plot(Gnuplot.Data(d, cols=(0,1), inline=1), >+ Gnuplot.Data(d, cols=(0,2), inline=1)) >+ wait('Change title and replot()') >+ g.title('New title') >+ g.replot() >+ wait('title=None') >+ g.plot(Gnuplot.Data(d, title=None)) >+ wait('title="Cosine of x"') >+ g.plot(Gnuplot.Data(d, title='Cosine of x')) >+ >+ print '############### test compute_Data ###########################' >+ x = numpy.arange(100)/5. - 10. >+ >+ wait('Plot Data, computed by Gnuplot.py') >+ g.plot( >+ Gnuplot.funcutils.compute_Data(x, lambda x: math.cos(x), inline=0) >+ ) >+ wait('Same thing, saved to a file') >+ Gnuplot.funcutils.compute_Data( >+ x, lambda x: math.cos(x), inline=0, filename=filename1 >+ ) >+ g.plot(Gnuplot.File(filename1)) >+ wait('Same thing, inline data') >+ g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, inline=1)) >+ wait('with_="lp 4 4"') >+ g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, with_='lp 4 4')) >+ >+ print '############### test hardcopy ###############################' >+ print '******** Generating postscript file "gp_test.ps" ********' >+ wait() >+ g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2', >+ title='cos(0.5*x^2)')) >+ g.hardcopy('gp_test.ps') >+ >+ wait('Testing hardcopy options: mode="eps"') >+ g.hardcopy('gp_test.ps', mode='eps') >+ wait('Testing hardcopy options: mode="landscape"') >+ g.hardcopy('gp_test.ps', mode='landscape') >+ wait('Testing hardcopy options: mode="portrait"') >+ g.hardcopy('gp_test.ps', mode='portrait') >+ wait('Testing hardcopy options: eps=1') >+ g.hardcopy('gp_test.ps', eps=1) >+ wait('Testing hardcopy options: mode="default"') >+ g.hardcopy('gp_test.ps', mode='default') >+ wait('Testing hardcopy options: enhanced=1') >+ g.hardcopy('gp_test.ps', enhanced=1) >+ wait('Testing hardcopy options: enhanced=0') >+ g.hardcopy('gp_test.ps', enhanced=0) >+ wait('Testing hardcopy options: color=1') >+ g.hardcopy('gp_test.ps', color=1) >+ # For some reason, >+ # g.hardcopy('gp_test.ps', color=0, solid=1) >+ # doesn't work here (it doesn't activate the solid option), even >+ # though the command sent to gnuplot looks correct. I'll >+ # tentatively conclude that it is a gnuplot bug. ### >+ wait('Testing hardcopy options: color=0') >+ g.hardcopy('gp_test.ps', color=0) >+ wait('Testing hardcopy options: solid=1') >+ g.hardcopy('gp_test.ps', solid=1) >+ wait('Testing hardcopy options: duplexing="duplex"') >+ g.hardcopy('gp_test.ps', solid=0, duplexing='duplex') >+ wait('Testing hardcopy options: duplexing="defaultplex"') >+ g.hardcopy('gp_test.ps', duplexing='defaultplex') >+ wait('Testing hardcopy options: fontname="Times-Italic"') >+ g.hardcopy('gp_test.ps', fontname='Times-Italic') >+ wait('Testing hardcopy options: fontsize=20') >+ g.hardcopy('gp_test.ps', fontsize=20) >+ >+ print '******** Generating svg file "gp_test.svg" ********' >+ wait() >+ g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2', >+ title='cos(0.5*x^2)')) >+ g.hardcopy('gp_test.svg', terminal='svg') >+ >+ wait('Testing hardcopy svg options: enhanced') >+ g.hardcopy('gp_test.ps', terminal='svg', enhanced='1') >+ >+ >+ print '############### test shortcuts ##############################' >+ wait('plot Func and Data using shortcuts') >+ g.plot('sin(x)', d) >+ >+ print '############### test splot ##################################' >+ wait('a 3-d curve') >+ g.splot(Gnuplot.Data(d, with_='linesp', inline=0)) >+ wait('Same thing, saved to a file') >+ Gnuplot.Data(d, inline=0, filename=filename1) >+ g.splot(Gnuplot.File(filename1, with_='linesp')) >+ wait('Same thing, inline data') >+ g.splot(Gnuplot.Data(d, with_='linesp', inline=1)) >+ >+ print '############### test GridData and compute_GridData ##########' >+ # set up x and y values at which the function will be tabulated: >+ x = numpy.arange(35)/2.0 >+ y = numpy.arange(30)/10.0 - 1.5 >+ # Make a 2-d array containing a function of x and y. First create >+ # xm and ym which contain the x and y values in a matrix form that >+ # can be `broadcast' into a matrix of the appropriate shape: >+ xm = x[:,numpy.newaxis] >+ ym = y[numpy.newaxis,:] >+ m = (numpy.sin(xm) + 0.1*xm) - ym**2 >+ wait('a function of two variables from a GridData file') >+ g('set parametric') >+ g('set data style lines') >+ g('set hidden') >+ g('set contour base') >+ g.xlabel('x') >+ g.ylabel('y') >+ g.splot(Gnuplot.GridData(m,x,y, binary=0, inline=0)) >+ wait('Same thing, saved to a file') >+ Gnuplot.GridData(m,x,y, binary=0, inline=0, filename=filename1) >+ g.splot(Gnuplot.File(filename1, binary=0)) >+ wait('Same thing, inline data') >+ g.splot(Gnuplot.GridData(m,x,y, binary=0, inline=1)) >+ >+ wait('The same thing using binary mode') >+ g.splot(Gnuplot.GridData(m,x,y, binary=1)) >+ wait('Same thing, using binary mode and an intermediate file') >+ Gnuplot.GridData(m,x,y, binary=1, filename=filename1) >+ g.splot(Gnuplot.File(filename1, binary=1)) >+ >+ wait('The same thing using compute_GridData to tabulate function') >+ g.splot(Gnuplot.funcutils.compute_GridData( >+ x,y, lambda x,y: math.sin(x) + 0.1*x - y**2, >+ )) >+ wait('Same thing, with an intermediate file') >+ Gnuplot.funcutils.compute_GridData( >+ x,y, lambda x,y: math.sin(x) + 0.1*x - y**2, >+ filename=filename1) >+ g.splot(Gnuplot.File(filename1, binary=1)) >+ >+ wait('Use compute_GridData in ufunc and binary mode') >+ g.splot(Gnuplot.funcutils.compute_GridData( >+ x,y, lambda x,y: numpy.sin(x) + 0.1*x - y**2, >+ ufunc=1, binary=1, >+ )) >+ wait('Same thing, with an intermediate file') >+ Gnuplot.funcutils.compute_GridData( >+ x,y, lambda x,y: numpy.sin(x) + 0.1*x - y**2, >+ ufunc=1, binary=1, >+ filename=filename1) >+ g.splot(Gnuplot.File(filename1, binary=1)) >+ >+ wait('And now rotate it a bit') >+ for view in range(35,70,5): >+ g('set view 60, %d' % view) >+ g.replot() >+ time.sleep(1.0) >+ >+ wait(prompt='Press return to end the test.\n') >+ finally: >+ os.unlink(filename1) >+ os.unlink(filename2) >+ >+ >+# when executed, just run main(): >+if __name__ == '__main__': >+ main() >+ >diff --git a/test.py b/test.py >deleted file mode 100755 >index 6965a29..0000000 >--- a/test.py >+++ /dev/null >@@ -1,336 +0,0 @@ >-#! /usr/bin/env python >- >-# $Id: test.py 302 2008-01-14 22:15:19Z bmcage $ >- >-# Copyright (C) 1999-2003 Michael Haggerty <mhagger@alum.mit.edu> >-# >-# This file is licensed under the GNU Lesser General Public License >-# (LGPL). See LICENSE.txt for details. >- >-"""test.py -- Exercise the Gnuplot.py module. >- >-This module is not meant to be a flashy demonstration; rather it is a >-thorough test of many combinations of Gnuplot.py features. >- >-""" >- >-import os, time, math, tempfile >-import numpy >- >-try: >- import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils >-except ImportError: >- # kludge in case Gnuplot hasn't been installed as a module yet: >- import __init__ >- Gnuplot = __init__ >- import PlotItems >- Gnuplot.PlotItems = PlotItems >- import funcutils >- Gnuplot.funcutils = funcutils >- >- >-def wait(str=None, prompt='Press return to show results...\n'): >- if str is not None: >- print str >- raw_input(prompt) >- >- >-def main(): >- """Exercise the Gnuplot module.""" >- >- print ( >- 'This program exercises many of the features of Gnuplot.py. The\n' >- 'commands that are actually sent to gnuplot are printed for your\n' >- 'enjoyment.' >- ) >- >- wait('Popping up a blank gnuplot window on your screen.') >- g = Gnuplot.Gnuplot(debug=1) >- g.clear() >- >- # Make two temporary files: >- if hasattr(tempfile, 'mkstemp'): >- (fd, filename1,) = tempfile.mkstemp(text=1) >- f = os.fdopen(fd, 'w') >- (fd, filename2,) = tempfile.mkstemp(text=1) >- else: >- filename1 = tempfile.mktemp() >- f = open(filename1, 'w') >- filename2 = tempfile.mktemp() >- try: >- for x in numpy.arange(100.)/5. - 10.: >- f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x))) >- f.close() >- >- print '############### test Func ###################################' >- wait('Plot a gnuplot-generated function') >- g.plot(Gnuplot.Func('sin(x)')) >- >- wait('Set title and axis labels and try replot()') >- g.title('Title') >- g.xlabel('x') >- g.ylabel('y') >- g.replot() >- >- wait('Style linespoints') >- g.plot(Gnuplot.Func('sin(x)', with_='linespoints')) >- wait('title=None') >- g.plot(Gnuplot.Func('sin(x)', title=None)) >- wait('title="Sine of x"') >- g.plot(Gnuplot.Func('sin(x)', title='Sine of x')) >- wait('axes=x2y2') >- g.plot(Gnuplot.Func('sin(x)', axes='x2y2', title='Sine of x')) >- >- print 'Change Func attributes after construction:' >- f = Gnuplot.Func('sin(x)') >- wait('Original') >- g.plot(f) >- wait('Style linespoints') >- f.set_option(with_='linespoints') >- g.plot(f) >- wait('title=None') >- f.set_option(title=None) >- g.plot(f) >- wait('title="Sine of x"') >- f.set_option(title='Sine of x') >- g.plot(f) >- wait('axes=x2y2') >- f.set_option(axes='x2y2') >- g.plot(f) >- >- print '############### test File ###################################' >- wait('Generate a File from a filename') >- g.plot(Gnuplot.File(filename1)) >- >- wait('Style lines') >- g.plot(Gnuplot.File(filename1, with_='lines')) >- >- wait('using=1, using=(1,)') >- g.plot(Gnuplot.File(filename1, using=1, with_='lines'), >- Gnuplot.File(filename1, using=(1,), with_='points')) >- wait('using=(1,2), using="1:3"') >- g.plot(Gnuplot.File(filename1, using=(1,2)), >- Gnuplot.File(filename1, using='1:3')) >- >- wait('every=5, every=(5,)') >- g.plot(Gnuplot.File(filename1, every=5, with_='lines'), >- Gnuplot.File(filename1, every=(5,), with_='points')) >- wait('every=(10,None,0), every="10::5"') >- g.plot(Gnuplot.File(filename1, with_='lines'), >- Gnuplot.File(filename1, every=(10,None,0)), >- Gnuplot.File(filename1, every='10::5')) >- >- wait('title=None') >- g.plot(Gnuplot.File(filename1, title=None)) >- wait('title="title"') >- g.plot(Gnuplot.File(filename1, title='title')) >- >- print 'Change File attributes after construction:' >- f = Gnuplot.File(filename1) >- wait('Original') >- g.plot(f) >- wait('Style linespoints') >- f.set_option(with_='linespoints') >- g.plot(f) >- wait('using=(1,3)') >- f.set_option(using=(1,3)) >- g.plot(f) >- wait('title=None') >- f.set_option(title=None) >- g.plot(f) >- >- print '############### test Data ###################################' >- x = numpy.arange(100)/5. - 10. >- y1 = numpy.cos(x) >- y2 = numpy.sin(x) >- d = numpy.transpose((x,y1,y2)) >- >- wait('Plot Data against its index') >- g.plot(Gnuplot.Data(y2, inline=0)) >- >- wait('Plot Data, specified column-by-column') >- g.plot(Gnuplot.Data(x,y2, inline=0)) >- wait('Same thing, saved to a file') >- Gnuplot.Data(x,y2, inline=0, filename=filename1) >- g.plot(Gnuplot.File(filename1)) >- wait('Same thing, inline data') >- g.plot(Gnuplot.Data(x,y2, inline=1)) >- >- wait('Plot Data, specified by an array') >- g.plot(Gnuplot.Data(d, inline=0)) >- wait('Same thing, saved to a file') >- Gnuplot.Data(d, inline=0, filename=filename1) >- g.plot(Gnuplot.File(filename1)) >- wait('Same thing, inline data') >- g.plot(Gnuplot.Data(d, inline=1)) >- wait('with_="lp 4 4"') >- g.plot(Gnuplot.Data(d, with_='lp 4 4')) >- wait('cols=0') >- g.plot(Gnuplot.Data(d, cols=0)) >- wait('cols=(0,1), cols=(0,2)') >- g.plot(Gnuplot.Data(d, cols=(0,1), inline=0), >- Gnuplot.Data(d, cols=(0,2), inline=0)) >- wait('Same thing, saved to files') >- Gnuplot.Data(d, cols=(0,1), inline=0, filename=filename1) >- Gnuplot.Data(d, cols=(0,2), inline=0, filename=filename2) >- g.plot(Gnuplot.File(filename1), Gnuplot.File(filename2)) >- wait('Same thing, inline data') >- g.plot(Gnuplot.Data(d, cols=(0,1), inline=1), >- Gnuplot.Data(d, cols=(0,2), inline=1)) >- wait('Change title and replot()') >- g.title('New title') >- g.replot() >- wait('title=None') >- g.plot(Gnuplot.Data(d, title=None)) >- wait('title="Cosine of x"') >- g.plot(Gnuplot.Data(d, title='Cosine of x')) >- >- print '############### test compute_Data ###########################' >- x = numpy.arange(100)/5. - 10. >- >- wait('Plot Data, computed by Gnuplot.py') >- g.plot( >- Gnuplot.funcutils.compute_Data(x, lambda x: math.cos(x), inline=0) >- ) >- wait('Same thing, saved to a file') >- Gnuplot.funcutils.compute_Data( >- x, lambda x: math.cos(x), inline=0, filename=filename1 >- ) >- g.plot(Gnuplot.File(filename1)) >- wait('Same thing, inline data') >- g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, inline=1)) >- wait('with_="lp 4 4"') >- g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, with_='lp 4 4')) >- >- print '############### test hardcopy ###############################' >- print '******** Generating postscript file "gp_test.ps" ********' >- wait() >- g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2', >- title='cos(0.5*x^2)')) >- g.hardcopy('gp_test.ps') >- >- wait('Testing hardcopy options: mode="eps"') >- g.hardcopy('gp_test.ps', mode='eps') >- wait('Testing hardcopy options: mode="landscape"') >- g.hardcopy('gp_test.ps', mode='landscape') >- wait('Testing hardcopy options: mode="portrait"') >- g.hardcopy('gp_test.ps', mode='portrait') >- wait('Testing hardcopy options: eps=1') >- g.hardcopy('gp_test.ps', eps=1) >- wait('Testing hardcopy options: mode="default"') >- g.hardcopy('gp_test.ps', mode='default') >- wait('Testing hardcopy options: enhanced=1') >- g.hardcopy('gp_test.ps', enhanced=1) >- wait('Testing hardcopy options: enhanced=0') >- g.hardcopy('gp_test.ps', enhanced=0) >- wait('Testing hardcopy options: color=1') >- g.hardcopy('gp_test.ps', color=1) >- # For some reason, >- # g.hardcopy('gp_test.ps', color=0, solid=1) >- # doesn't work here (it doesn't activate the solid option), even >- # though the command sent to gnuplot looks correct. I'll >- # tentatively conclude that it is a gnuplot bug. ### >- wait('Testing hardcopy options: color=0') >- g.hardcopy('gp_test.ps', color=0) >- wait('Testing hardcopy options: solid=1') >- g.hardcopy('gp_test.ps', solid=1) >- wait('Testing hardcopy options: duplexing="duplex"') >- g.hardcopy('gp_test.ps', solid=0, duplexing='duplex') >- wait('Testing hardcopy options: duplexing="defaultplex"') >- g.hardcopy('gp_test.ps', duplexing='defaultplex') >- wait('Testing hardcopy options: fontname="Times-Italic"') >- g.hardcopy('gp_test.ps', fontname='Times-Italic') >- wait('Testing hardcopy options: fontsize=20') >- g.hardcopy('gp_test.ps', fontsize=20) >- >- print '******** Generating svg file "gp_test.svg" ********' >- wait() >- g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2', >- title='cos(0.5*x^2)')) >- g.hardcopy('gp_test.svg', terminal='svg') >- >- wait('Testing hardcopy svg options: enhanced') >- g.hardcopy('gp_test.ps', terminal='svg', enhanced='1') >- >- >- print '############### test shortcuts ##############################' >- wait('plot Func and Data using shortcuts') >- g.plot('sin(x)', d) >- >- print '############### test splot ##################################' >- wait('a 3-d curve') >- g.splot(Gnuplot.Data(d, with_='linesp', inline=0)) >- wait('Same thing, saved to a file') >- Gnuplot.Data(d, inline=0, filename=filename1) >- g.splot(Gnuplot.File(filename1, with_='linesp')) >- wait('Same thing, inline data') >- g.splot(Gnuplot.Data(d, with_='linesp', inline=1)) >- >- print '############### test GridData and compute_GridData ##########' >- # set up x and y values at which the function will be tabulated: >- x = numpy.arange(35)/2.0 >- y = numpy.arange(30)/10.0 - 1.5 >- # Make a 2-d array containing a function of x and y. First create >- # xm and ym which contain the x and y values in a matrix form that >- # can be `broadcast' into a matrix of the appropriate shape: >- xm = x[:,numpy.newaxis] >- ym = y[numpy.newaxis,:] >- m = (numpy.sin(xm) + 0.1*xm) - ym**2 >- wait('a function of two variables from a GridData file') >- g('set parametric') >- g('set data style lines') >- g('set hidden') >- g('set contour base') >- g.xlabel('x') >- g.ylabel('y') >- g.splot(Gnuplot.GridData(m,x,y, binary=0, inline=0)) >- wait('Same thing, saved to a file') >- Gnuplot.GridData(m,x,y, binary=0, inline=0, filename=filename1) >- g.splot(Gnuplot.File(filename1, binary=0)) >- wait('Same thing, inline data') >- g.splot(Gnuplot.GridData(m,x,y, binary=0, inline=1)) >- >- wait('The same thing using binary mode') >- g.splot(Gnuplot.GridData(m,x,y, binary=1)) >- wait('Same thing, using binary mode and an intermediate file') >- Gnuplot.GridData(m,x,y, binary=1, filename=filename1) >- g.splot(Gnuplot.File(filename1, binary=1)) >- >- wait('The same thing using compute_GridData to tabulate function') >- g.splot(Gnuplot.funcutils.compute_GridData( >- x,y, lambda x,y: math.sin(x) + 0.1*x - y**2, >- )) >- wait('Same thing, with an intermediate file') >- Gnuplot.funcutils.compute_GridData( >- x,y, lambda x,y: math.sin(x) + 0.1*x - y**2, >- filename=filename1) >- g.splot(Gnuplot.File(filename1, binary=1)) >- >- wait('Use compute_GridData in ufunc and binary mode') >- g.splot(Gnuplot.funcutils.compute_GridData( >- x,y, lambda x,y: numpy.sin(x) + 0.1*x - y**2, >- ufunc=1, binary=1, >- )) >- wait('Same thing, with an intermediate file') >- Gnuplot.funcutils.compute_GridData( >- x,y, lambda x,y: numpy.sin(x) + 0.1*x - y**2, >- ufunc=1, binary=1, >- filename=filename1) >- g.splot(Gnuplot.File(filename1, binary=1)) >- >- wait('And now rotate it a bit') >- for view in range(35,70,5): >- g('set view 60, %d' % view) >- g.replot() >- time.sleep(1.0) >- >- wait(prompt='Press return to end the test.\n') >- finally: >- os.unlink(filename1) >- os.unlink(filename2) >- >- >-# when executed, just run main(): >-if __name__ == '__main__': >- main() >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 237626
: 165393