From: <ai...@us...> - 2008-10-18 23:28:38
|
Revision: 8923 http://plplot.svn.sourceforge.net/plplot/?rev=8923&view=rev Author: airwin Date: 2008-10-18 23:28:32 +0000 (Sat, 18 Oct 2008) Log Message: ----------- Apply variable-opacity black shade to left side of plot with plshades. This commit illustrates that plshades is not adequate for this task of approximating a gradient. The various rectangles overlap each other slightly given twice the opacity at the edges and therefore an extremely uneven effect. If you use lots of rectangles (say 1001 points in clevel), then many different edges overlap simultanously given much higher opacity that blackens the whole left-hand side of the plot much too much which makes this method unacceptable even if you were willing to accept the file bloat caused by it. Standard example 30 also shows the deficiencies of plshades (which is the best method PLplot has) for approximating gradients. The purpose of this commit is to illustrate the PLplot gradient problem. There is currently no PLplot solution for this issue. Therefore, this attempt at approximating a gradient with PLplot will be removed in the next commit. Modified Paths: -------------- trunk/examples/python/plplot_logo.py Modified: trunk/examples/python/plplot_logo.py =================================================================== --- trunk/examples/python/plplot_logo.py 2008-10-18 22:34:52 UTC (rev 8922) +++ trunk/examples/python/plplot_logo.py 2008-10-18 23:28:32 UTC (rev 8923) @@ -101,7 +101,39 @@ # magnitude colored plot with faceted squares cmap1_init(0) plsurf3d(x, y, z, MAG_COLOR | FACETED, ()) + + # Transluscent gradient over left portion of surface. + plvpor(0.0, 0.7, 0.0, 1.0) + plwind(0.0, 1.0, 0.0, 1.0) + # The overlaid box is drawn using plshades with a color map that is + # the same color but has a linearly varying transparency. + + pos = array([0.0, 1.0]) + rcoord = array([0.0, 0.0]) + gcoord = array([0.0, 0.0]) + bcoord = array([0.0, 0.0]) + acoord = array([0.0, 1.0]) + rev = array([0, 0]) + # Create the color map with 128 colors and use plscmap1la to initialize + # the color values with a linear varying 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][0] = 1.0 + z[0][1] = 1.0 + + # Set the color levels array. These levels are also between 0.0 and 1.0 + clevel = 0.05*arange(21) + + # 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() # Terminate plplot plend() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |