|
From: <ai...@us...> - 2008-10-18 19:33:42
|
Revision: 8920
http://plplot.svn.sourceforge.net/plplot/?rev=8920&view=rev
Author: airwin
Date: 2008-10-18 19:33:37 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Add plplot_logo.py, a Python script to generate a logo for PLplot. This
script should be run with the -geometry 800x120 option in the installed
examples tree and that will produce the basic plot result that is needed for
the logo. However, additional improvements to this logo (adjustments of the
underlying plot as well as shading and overall text still to be added) are
planned.
Modified Paths:
--------------
trunk/examples/python/CMakeLists.txt
Added Paths:
-----------
trunk/examples/python/plplot_logo.py
Modified: trunk/examples/python/CMakeLists.txt
===================================================================
--- trunk/examples/python/CMakeLists.txt 2008-10-18 00:17:07 UTC (rev 8919)
+++ trunk/examples/python/CMakeLists.txt 2008-10-18 19:33:37 UTC (rev 8920)
@@ -68,6 +68,7 @@
prova.py
xw14.py
xw17.py
+plplot_logo.py
)
if(ENABLE_pygcw)
Added: trunk/examples/python/plplot_logo.py
===================================================================
--- trunk/examples/python/plplot_logo.py (rev 0)
+++ trunk/examples/python/plplot_logo.py 2008-10-18 19:33:37 UTC (rev 8920)
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2008 Alan W. Irwin
+#
+# This file is part of PLplot.
+#
+# PLplot is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library General Public License as published
+# by the Free Software Foundation; version 2 of the License.
+#
+# PLplot is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with the file PLplot; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+# Generate PLplot logo.
+
+# Append to effective python path so that can find plplot modules.
+from plplot_python_start import *
+
+import sys
+from plplot import *
+
+# Parse and process command line arguments
+plparseopts(sys.argv, PL_PARSE_FULL)
+
+# Initialize plplot
+plinit()
+
+from plplot_py_demos import *
+
+XPTS = 35 # Data points in x
+YPTS = 46 # Data points in y
+
+alt = 60.0
+az = 30.0
+# Routine for defining a specific color map 1 in HLS space.
+# if gray is true, use basic grayscale variation from half-dark to light.
+# otherwise use false color variation from blue (240 deg) to red (360 deg).
+def cmap1_init(gray):
+ # Independent variable of control points.
+ i = array((0., 1.))
+ if gray:
+ # Hue for control points. Doesn't matter since saturation is zero.
+ h = array((0., 0.))
+ # Lightness ranging from half-dark (for interest) to light.
+ l = array((0.5, 1.))
+ # Gray scale has zero saturation
+ s = array((0., 0.))
+ else:
+ # Hue ranges from blue (240 deg) to red (0 or 360 deg)
+ h = array((240., 0.))
+ # Lightness and saturation are constant (values taken from C example).
+ l = array((0.6, 0.6))
+ s = array((0.8, 0.8))
+
+ # number of cmap1 colours is 256 in this case.
+ plscmap1n(256)
+ # Interpolate between control points to set up cmap1.
+ plscmap1l(0, i, h, l, s)
+
+def main():
+
+ rosen = 1
+ x = (arange(XPTS) - (XPTS / 2)) / float(XPTS / 2)
+ y = (arange(YPTS) - (YPTS / 2)) / float(YPTS / 2)
+ if rosen == 1:
+ x = 1.5*x
+ y = 0.5 + y
+ x.shape = (-1,1)
+ r2 = (x*x) + (y*y)
+ z = (1. - x)*(1. - x) + 100 * (x*x - y)*(x*x - y)
+ # The log argument may be zero for just the right grid. */
+ z = log(choose(greater(z,0.), (exp(-5.), z)))
+
+ x.shape = (-1,)
+ zmin = min(z.flat)
+ zmax = max(z.flat)
+ nlevel = 10
+ step = (zmax-zmin)/(nlevel+1)
+ clevel = zmin + step + arange(nlevel)*step
+ plschr(0., 1.5)
+ plwid(1)
+ pladv(0)
+ plvpor(0.0, 1.0, 0.0, 1.0)
+ plwind(-0.3, 0.8, 0.05, 0.4)
+ plcol0(1)
+ plw3d(1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax,
+ alt, az)
+ plbox3("bnstu", "x axis", 0.0, 0,
+ "bnstu", "y axis", 0.0, 0,
+ "bcdmnstuv", "z axis", 0.0, 0)
+
+ plcol0(2)
+ # magnitude colored plot with faceted squares
+ cmap1_init(0)
+ plsurf3d(x, y, z, MAG_COLOR | FACETED, ())
+
+main()
+# Terminate plplot
+plend()
Property changes on: trunk/examples/python/plplot_logo.py
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|