octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave CVS: Problem with axis and keyboard


From: John W. Eaton
Subject: Re: Octave CVS: Problem with axis and keyboard
Date: Thu, 13 Sep 2007 04:03:46 -0400

On  4-Sep-2007, Fredrik Lingvall wrote:

| Also, found I two more issues: mesh:es defaults to 'colormap gray' 
| (should be 'jet' ?)

I made the following change.

Thanks,

jwe


2007-09-13  John W. Eaton  <address@hidden>

        * graphics.h.in (colormap_property::colormap_property):
        Use jet colormap as default.


Index: src/graphics.h.in
===================================================================
RCS file: /cvs/octave/src/graphics.h.in,v
retrieving revision 1.2
diff -u -u -r1.2 graphics.h.in
--- src/graphics.h.in   12 Sep 2007 20:14:35 -0000      1.2
+++ src/graphics.h.in   13 Sep 2007 08:01:47 -0000
@@ -289,10 +289,40 @@
   {
     if (cmap.is_empty ())
       {
-       cmap = Matrix (64, 3);
+       cmap = Matrix (64, 3, 0.0);
 
        for (octave_idx_type i = 0; i < 64; i++)
-         cmap(i,0) = cmap(i,1) = cmap(i,2) = i / 64.0;
+         {
+           // This is the jet colormap.  It would be nice to be able
+           // to feval the jet function but since there is a static
+           // property object that includes a colormap_property
+           // object, we need to initialize this before main is even
+           // called, so calling an interpreted function is not
+           // possible.
+
+           double x = i / 63.0;
+
+           if (x >= 3.0/8.0 && x < 5.0/8.0)
+             cmap(i,0) = 4.0 * x - 3.0/2.0;
+           else if (x >= 5.0/8.0 && x < 7.0/8.0)
+             cmap(i,0) = 1.0;
+           else if (x >= 7.0/8.0)
+             cmap(i,0) = -4.0 * x + 9.0/2.0;
+
+           if (x >= 1.0/8.0 && x < 3.0/8.0)
+             cmap(i,1) = 4.0 * x - 1.0/2.0;
+           else if (x >= 3.0/8.0 && x < 5.0/8.0)
+             cmap(i,1) = 1.0;
+           else if (x >= 5.0/8.0 && x < 7.0/8.0)
+             cmap(i,1) = -4.0 * x + 7.0/2.0;
+
+           if (x < 1/8)
+             cmap(i,2) = 4.0 * x + 1.0/2.0;
+           else if (x >= 1.0/8.0 && x < 3.0/8.0)
+             cmap(i,2) = 1.0;
+           else if (x >= 3.0/8.0 && x < 5.0/8.0)
+             cmap(i,2) = -4.0 * x + 5.0/2.0;
+         }
       }
 
     validate ();

reply via email to

[Prev in Thread] Current Thread [Next in Thread]