On 2012-01-20 17:51-0800 Alan W. Irwin wrote:

> Andrew and I have recently been playing with examples/c/x21c.c, but I
> want to emphasize our changes are not yet ready for propagation to
> other languages because I discovered a plstring or device bug for -dev
> xwin and -dev tk that needs to be tracked down before we can finalize
> these changes.

OK. That bug (which turned out to be one introduced by me in the
example itself) has now been fixed (revision 12141).

Andrew's idea (which I really like) was to use the first page to show
the effect of plcol1 on text.  I improved on that idea by adding
uniform cmap1 colours for the whole example. I also took this
opportunity to use the recommended plstring rather than deprecated
plpoin for generating the multiplication sign symbols to mark the
points for the first page.  Both Andrew and I like the results
and feel these changes are ready to propagate to all the languages.

Here is the complete set of C changes for this example:

Index: examples/c/x21c.c
===================================================================
--- examples/c/x21c.c   (revision 12095)
+++ examples/c/x21c.c   (working copy)
@@ -180,6 +180,8 @@

      plinit();

+    // Use a colour map with no black band in the middle.
+    cmap1_init();
      // Initialise random number generator
      plseed( 5489 );

@@ -198,13 +200,26 @@
      plAlloc2dGrid( &zg, xp, yp );    // the output grided data
      clev = (PLFLT *) malloc( (size_t) nl * sizeof ( PLFLT ) );

-    // printf("Npts=%d gridx=%d gridy=%d", pts, xp, yp);
      plcol0( 1 );
      plenv( xm, xM, ym, yM, 2, 0 );
      plcol0( 15 );
      pllab( "X", "Y", "The original data sampling" );
-    plcol0( 2 );
-    plpoin( pts, x, y, 5 );
+    for ( i = 0; i < pts; i++ )
+    {
+        plcol1( ( z[i] - zmin ) / ( zmax - zmin ) );
+        // The following plstring call should be the the equivalent of
+        // plpoin( 1, &x[i], &y[i], 5 ); Use plstring because it is
+        // not deprecated like plpoin and has much more powerful
+        // capabilities.  N.B. symbol 141 works for Hershey devices
+        // (e.g., -dev xwin) only if plfontld( 0 ) has been called
+        // while symbol 727 works only if plfontld( 1 ) has been
+        // called.  The latter is the default which is why we use 727
+        // here to represent a centred X (multiplication) symbol.
+        // This dependence on plfontld is one of the limitations of
+        // the Hershey escapes for PLplot, but the upside is you get
+        // reasonable results for both Hershey and Unicode devices.
+        plstring( 1, &x[i], &y[i], "#(727)" );
+    }
      pladv( 0 );

      plssub( 3, 2 );

Please propagate these changes in example 21 to all your favorite languages.

Alan

__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to