|
From: <ai...@us...> - 2009-12-02 00:34:01
|
Revision: 10658
http://plplot.svn.sourceforge.net/plplot/?rev=10658&view=rev
Author: airwin
Date: 2009-12-02 00:33:49 +0000 (Wed, 02 Dec 2009)
Log Message:
-----------
Make python examples 25 and 30 produce consistent results (especially
plgradient results) with their C counterparts.
Modified Paths:
--------------
trunk/examples/python/xw25.py
trunk/examples/python/xw30.py
Modified: trunk/examples/python/xw25.py
===================================================================
--- trunk/examples/python/xw25.py 2009-12-02 00:30:21 UTC (rev 10657)
+++ trunk/examples/python/xw25.py 2009-12-02 00:33:49 UTC (rev 10658)
@@ -51,38 +51,41 @@
[ -80.0, 80.0 ],
[ -120.0, 120.0 ] ]
- for j in range(4):
+ for k in range(2):
+ for j in range(4):
+
+ # Polygon 1: a diamond
+ if (j == 0):
+ x0 = [0, -100, 0, 100]
+ y0 = [-100, 0, 100, 0]
+ # Polygon 2: a diamond - reverse direction
+ elif (j == 1):
+ x0 = [100, 0, -100, 0]
+ y0 = [0, 100, 0, -100]
+ # Polygon 3: a square with punctures
+ elif (j == 2):
+ x0 = [-100, -100, 80, -100, -100, -80, 0, 80, 100, 100]
+ y0 = [-100, -80, 0, 80, 100, 100, 80, 100, 100, -100]
+ # Polygon 4: a square with punctures - reverse direction
+ elif (j == 3):
+ x0 = [100, 100, 80, 0, -80, -100, -100, 80, -100, -100]
+ y0 = [-100, 100, 100, 80, 100, 100, 80, 0, -80, -100]
+
+ for i in range(9):
+ pladv(0)
+ plvsta()
+ plwind(xextreme[i][0], xextreme[i][1], yextreme[i][0], yextreme[i][1])
- # Polygon 1: a diamond
- if (j == 0):
- x0 = [0, -100, 0, 100]
- y0 = [-100, 0, 100, 0]
- # Polygon 2: a diamond - reverse direction
- elif (j == 1):
- x0 = [100, 0, -100, 0]
- y0 = [0, 100, 0, -100]
- # Polygon 3: a square with punctures
- elif (j == 2):
- x0 = [-100, -100, 80, -100, -100, -80, 0, 80, 100, 100]
- y0 = [-100, -80, 0, 80, 100, 100, 80, 100, 100, -100]
- # Polygon 4: a square with punctures - reverse direction
- elif (j == 3):
- x0 = [100, 100, 80, 0, -80, -100, -100, 80, -100, -100]
- y0 = [-100, 100, 100, 80, 100, 100, 80, 0, -80, -100]
+ plcol0(2)
+ plbox("bc", 1.0, 0, "bcnv", 10.0, 0)
+ plcol0(1)
+ plpsty(0)
+ if (k == 0):
+ plfill(x0,y0)
+ else:
+ plgradient(x0, y0, 45.)
+ plcol0(2)
+ pllsty(1)
+ plline(x0,y0)
- for i in range(9):
- pladv(0)
- plvsta()
- plwind(xextreme[i][0], xextreme[i][1], yextreme[i][0], yextreme[i][1])
-
- plcol0(2)
- plbox("bc", 1.0, 0, "bcnv", 10.0, 0)
- plcol0(1)
- plpsty(0)
- plfill(x0,y0)
- plcol0(2)
- pllsty(1)
- plline(x0,y0)
-
-
main()
Modified: trunk/examples/python/xw30.py
===================================================================
--- trunk/examples/python/xw30.py 2009-12-02 00:30:21 UTC (rev 10657)
+++ trunk/examples/python/xw30.py 2009-12-02 00:33:49 UTC (rev 10658)
@@ -112,27 +112,23 @@
py[3] = py[2]
plfill(px, py)
- # The overlaid box is drawn using plshades with a color map that is
- # the same color but has a linearly varying transparency.
-
# Create the color map with 128 colors and use plscmap1la to initialize
- # the color values with a linear varying transparency (or alpha)
+ # the color values with a linear varying red transparency (or alpha)
plscmap1n(128)
plscmap1la(1, pos, rcoord, gcoord, bcoord, acoord, rev)
- # Create a 2 x 2 array that contains the z values (0.0 to 1.0) that will
- # used for the shade plot. plshades will use linear interpolation to
- # calculate the z values of all the intermediate points in this array.
- z = reshape(zeros(2*2),(2,2))
- z[0][1] = 1.0
- z[1][1] = 1.0
+ # Use that cmap1 to create a transparent red gradient for the whole
+ # window.
+ px[0] = 0.
+ px[1] = 1.
+ px[2] = 1.
+ px[3] = 0.
+
+ py[0] = 0.
+ py[1] = 0.
+ py[2] = 1.
+ py[3] = 1.
- # Set the color levels array. These levels are also between 0.0 and 1.0
- clevel = 0.01*arange(101)
+ plgradient(px, py, 90.)
- # Draw the shade plot with zmin = 0.0, zmax = 1.0 and x and y coordinate
- # ranges such that it fills the entire plotting area.
- plshades(z, 0.0, 1.0, 0.0, 1.0, clevel, 0, 1)
-
-
main()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|