Re: [Plplot-devel] Alternate cmap0 in plctrl.c

2009-08-19 Thread Hezekiah M. Carty
On Tue, Aug 18, 2009 at 6:42 PM, Alan W. Irwinir...@beluga.phys.uvic.ca wrote:
 On 2009-08-18 16:45-0500 Hezekiah M. Carty wrote:

 PLplot has apparently had, for some time, a commented-out alternate
 color map 0 with a white background and multiple foreground colors.  I
 think that this, or a similar cmap0, is worth including with PLplot.

 I agree that looks pretty good and is worth preserving as yet another
 palette file.

Committed as revision 10290.  I left the name as cmap0_alternate.pal
for now.  The filename can be changed later to match whatever scheme
we decide on.

 Is it worth adding a PLplot cmake/compile-time option to change the
 default color map 0 to this or some other alternate?  This would allow
 someone who wants white backgrounds to be the rule rather than the
 exception to avoid having to set the palette for each plot.

 I think this is a good idea.  The DEFAULT_CMAP0_FILE and DEFAULT_CMAP1_FILE
 options (to pick some reasonable names for those cmake options) should just
 be a PLplot builder-specified string corresponding to one of the existing
 cmap[01] palette files in the standard places where palette files appear
 (which includes the current directory for those who really want to play with
 colour schemes). If those options were not specified, then the fallback for
 the default would be the existing cmap[01]_default.pal files which give the
 default colour scheme that our traditional users expect.

 Such a change would also allow us to do the initial setup of cmap0 and cmap1
 when libplplot is opened using the specified default palette files.  I feel
 such use of palette files to initialize cmap[01] is an improvement over the
 current hard-coded specification of the default cmap0 and cmap1 when
 libplplot is opened.

Committed as revision 10298.

A user can now configure PLplot with:

cmake -DDEFAULT_CMAP0_FILE=cmap0_alternate.pal
-DDEFAULT_CMAP1_FILE=cmap1_blue_yellow.pal ...

or any other cmap0 and/or cmap1 file to change the default PLplot
colors.  If these options are not provided then the existing default
colors are used (black background for cmap0, blue - black - red for
cmap1).

A few notes on this change:
1. All color palettes are now loaded from disk, even the defaults when
no user configuration is provided.

2. As a result of (1), color map 1 will not adjust to a change in the
background color of color map 0 since both are loaded from disk.

3. The existence of the default color map files is not checked by
cmake.  I left this out because a user may want to use
non-PLplot-provided color maps as their defaults.  Would a cmake-time
warning be appropriate here, to catch cases of mistyped filenames of
the included color palettes?

This is a relatively simple change to the PLplot code, and it all
seems to work properly on my system.  It affects some fairly central
pieces of PLplot though, so I think it deserves some scrutiny from
others if you have the time.

Thanks,

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Alternate cmap0 in plctrl.c

2009-08-19 Thread Andrew Ross
On Tue, Aug 18, 2009 at 04:42:53PM -0700, Alan Irwin wrote:
 
 Palette file names that actually describe the colours in the palette are
 going to be virtually impossible to realize in general so I suggest we
 should normally use a memorable name for palette files following some 
 naming convention we all agree on. For example, we could take names from the
 collection of Arabic names for stars (betelgeuse, etc.) or the collection of
 names donoting bird genera, or whatever takes our fancy (so long as there is
 lots of choice of names). (When we had a similar problem naming the
 computers in our astrogroup back in 1991 we decided on a marine animal
 naming theme which explains my e-mail address.)

Personally I would like names that at least give the user some idea of what
they might get. Matlab / octave have palette names like autumn (brown / red
shades), cool (blues), hot (reds). The names need not be colours. We already 
have a set of such examples in the octave higher level graphics routines
in bindings/octave/PLplot/ .

Andrew

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Alternate cmap0 in plctrl.c

2009-08-18 Thread Hezekiah M. Carty
On Tue, Aug 18, 2009 at 4:45 PM, Hezekiah M.
Cartyhezekiahca...@users.sourceforge.net wrote:
 Is it worth adding a PLplot cmake/compile-time option to change the
 default color map 0 to this or some other alternate?  This would allow
 someone who wants white backgrounds to be the rule rather than the
 exception to avoid having to set the palette for each plot.

I have attached an initial patch which adds cmake configuration
support for enabling the alternate cmap0 by default.  One can pass
-DPL_ALT_CMAP0=ON to cmake to use to alternate color map 0 colors by
default.  If PL_ALT_CMAP0 is set to OFF or is left unset (it defaults
to OFF), the current default (black background) color map 0 palette is
used.

If this compile-time palette support is added to PLplot, I would
appreciate a review of this patch, particularly the CMake pieces.  I
think I am setting things up correctly, but I'm not sure if everything
is in the proper location.

Enjoy,

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science
diff --git a/include/plConfig.h.cmake b/include/plConfig.h.cmake
index 8bc0252..b90723d 100644
--- a/include/plConfig.h.cmake
+++ b/include/plConfig.h.cmake
@@ -75,4 +75,7 @@
  * - broken Mac OSX systems */
 #cmakedefine PL_BROKEN_ISNAN_CXX
 
+/* Define if you want to use the alternate cmap0 */
+#cmakedefine PL_ALT_CMAP0
+
 #endif	/* __PLCONFIG_H__ */
diff --git a/src/plctrl.c b/src/plctrl.c
index 4428ed8..ae51a59 100644
--- a/src/plctrl.c
+++ b/src/plctrl.c
@@ -898,6 +898,7 @@ plcmap0_def(int imin, int imax)
 {
 int i;
 
+#ifndef PL_ALT_CMAP0
 color_def(0,0,   0,   0, 1.0, black );/* black */
 color_def(1,  255,   0,   0, 1.0, red);   /* red */
 color_def(2,  255, 255,   0, 1.0, yellow );   /* yellow */
@@ -914,23 +915,24 @@ plcmap0_def(int imin, int imax)
 color_def(13, 255,   0, 255, 1.0, magenta );	/* magenta */
 color_def(14, 250, 128, 114, 1.0, salmon );	/* salmon */
 color_def(15, 255, 255, 255, 1.0, white );	/* white */
-
-/* color_def(0, 255, 255, 255, white );	/\* white *\/ */
-/* color_def(1,0,   0,   0, black );	/\* black *\/ */
-/* color_def(2,0,   0, 255, blue );	/\* blue *\/ */
-/* color_def(3,  255,   0,   0, red);	/\* red *\/ */
-/* color_def(4,  165,  42,  42, brown );	/\* brown *\/ */
-/* color_def(5, 250, 128, 114, salmon );	/\* salmon *\/ */
-/* color_def(6,  255, 192, 203, pink );	/\* pink *\/ */
-/* color_def(7,  127, 255, 212, aquamarine );	/\* aquamarine *\/ */
-/* color_def(8,  245, 222, 179, wheat );	/\* wheat *\/ */
-/* color_def(9,  64, 224, 208, turquoise );	/\* turquoise *\/ */
-/* color_def(10,  190, 190, 190, grey );	/\* grey *\/ */
-/* color_def(11,   0, 255, 255, cyan );	/\* cyan *\/ */
-/* color_def(12,0, 255,   0, green );	/\* green *\/ */
-/* color_def(13,  255, 255,   0, yellow );	/\* yellow *\/ */
-/* color_def(14, 255,   0, 255, magenta );	/\* magenta *\/ */
-/* color_def(15, 138,  43, 226, BlueViolet );	/\* Blue Violet *\/ */
+#else
+color_def(0,  255, 255, 255, 1.0, white );	/* white */
+color_def(1,0,   0,   0, 1.0, black );	/* black */
+color_def(2,0,   0, 255, 1.0, blue );	/* blue */
+color_def(3,  255,   0,   0, 1.0, red);	/* red */
+color_def(4,  165,  42,  42, 1.0, brown );	/* brown */
+color_def(5,  250, 128, 114, 1.0, salmon );	/* salmon */
+color_def(6,  255, 192, 203, 1.0, pink );	/* pink */
+color_def(7,  127, 255, 212, 1.0, aquamarine );   /* aquamarine */
+color_def(8,  245, 222, 179, 1.0, wheat );	/* wheat */
+color_def(9,   64, 224, 208, 1.0, turquoise );	/* turquoise */
+color_def(10, 190, 190, 190, 1.0, grey ); /* grey */
+color_def(11,   0, 255, 255, 1.0, cyan );	/* cyan */
+color_def(12,   0, 255,   0, 1.0, green );	/* green */
+color_def(13, 255, 255,   0, 1.0, yellow );	/* yellow */
+color_def(14, 255,   0, 255, 1.0, magenta );	/* magenta */
+color_def(15, 138,  43, 226, 1.0, BlueViolet );	/* Blue Violet */
+#endif
 
 /* Any others are just arbitrarily set */
 
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Alternate cmap0 in plctrl.c

2009-08-18 Thread Alan W. Irwin
On 2009-08-18 16:45-0500 Hezekiah M. Carty wrote:

 PLplot has apparently had, for some time, a commented-out alternate
 color map 0 with a white background and multiple foreground colors.  I
 think that this, or a similar cmap0, is worth including with PLplot.

I agree that looks pretty good and is worth preserving as yet another
palette file.

 I have attached the pngcairo output from the first page of example 2
 as an illustration of this alternative palette versus the default
 palette.  If there are no objections I will add this as
 cmap0_alternate.pal to the PLplot trunk.  Any suggestions for a better
 file name?

Palette file names that actually describe the colours in the palette are
going to be virtually impossible to realize in general so I suggest we
should normally use a memorable name for palette files following some 
naming convention we all agree on. For example, we could take names from the
collection of Arabic names for stars (betelgeuse, etc.) or the collection of
names donoting bird genera, or whatever takes our fancy (so long as there is
lots of choice of names). (When we had a similar problem naming the
computers in our astrogroup back in 1991 we decided on a marine animal
naming theme which explains my e-mail address.)


 Is it worth adding a PLplot cmake/compile-time option to change the
 default color map 0 to this or some other alternate?  This would allow
 someone who wants white backgrounds to be the rule rather than the
 exception to avoid having to set the palette for each plot.

I think this is a good idea.  The DEFAULT_CMAP0_FILE and DEFAULT_CMAP1_FILE
options (to pick some reasonable names for those cmake options) should just
be a PLplot builder-specified string corresponding to one of the existing
cmap[01] palette files in the standard places where palette files appear
(which includes the current directory for those who really want to play with
colour schemes). If those options were not specified, then the fallback for
the default would be the existing cmap[01]_default.pal files which give the
default colour scheme that our traditional users expect.

Such a change would also allow us to do the initial setup of cmap0 and cmap1
when libplplot is opened using the specified default palette files.  I feel
such use of palette files to initialize cmap[01] is an improvement over the
current hard-coded specification of the default cmap0 and cmap1 when
libplplot is opened.

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); PLplot scientific plotting software
package (plplot.org); 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
__

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Alternate cmap0 in plctrl.c

2009-08-18 Thread Alan W. Irwin
On 2009-08-18 18:21-0500 Hezekiah M. Carty wrote:

 On Tue, Aug 18, 2009 at 4:45 PM, Hezekiah M.
 Cartyhezekiahca...@users.sourceforge.net wrote:
 Is it worth adding a PLplot cmake/compile-time option to change the
 default color map 0 to this or some other alternate?  This would allow
 someone who wants white backgrounds to be the rule rather than the
 exception to avoid having to set the palette for each plot.

 I have attached an initial patch which adds cmake configuration
 support for enabling the alternate cmap0 by default.  One can pass
 -DPL_ALT_CMAP0=ON to cmake to use to alternate color map 0 colors by
 default.  If PL_ALT_CMAP0 is set to OFF or is left unset (it defaults
 to OFF), the current default (black background) color map 0 palette is
 used.

I prefer a palette file approach rather than hard-coded approach.  See
my previous post on this (which crossed with your latest post) where
I give more details of how I hope this evolves.

With regard to your cmake question, I think #define (rather than
cmakedefine) in config.h.cmake is the way to go.  See the first part of that
file for how #defines are configured corresponding to various CMake
variables.  In these cmap[01] cases, the variables would be strings that are
specified as CMake options with default values of cmap[01]_default.pal
(i.e., used if the user does not specify those options).

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); PLplot scientific plotting software
package (plplot.org); 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
__

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel