On 2012-01-18 13:25-0800 phil rosenberg wrote:

> Hi Andrew and Maurice
>  
> I agree that the recommendation is that cmap1 is used for e.g. colourscales 
> of shade plots, and cmap0 be used for points/lines/text,
> but the manual seems to imply this is a recommendation and that whichever map 
> you use to set the colour will be used. The psc driver
> follows the latter behaviour. You may even see it as advantage to be able to 
> set cmap1 colour fror a fill, but then a cmap0 colour for
> text.
>  
> The situation I was in was using plstring to plot points on an x, y scale but 
> I wanted the colour of the points to vary with a third
> variable, z. Example psudocode is below.
>  
> //x, y, z 1d data
> double x[20];
> double y[20];
> double z[20];
>  
> double maxz;//maximum value in the z array
> char pointcharacter[2]; //character used as a datapoint on my plot
>  
> //some code to initialize my data
> //some code to initialize cmap1 using a hls colour scale
>  
> for(int i=0; i<20; i++)
> {
>     plcol1(z[i]/maxz);
>     plstring(1,x+i,y+i,pointcharacter);
> }
>  
> One alternative could be to introduce a function which returns the rgb/hls 
> value of col1, allowing col0 to be set. However I think that
> given the wxWidgets drivers differ in behaviour from the psc driver (and I 
> have a feeling the one of the three wxWidgets drivers
> differs from the others) means that this is a bug and all drivers should 
> behave the same in this respect, whichever way is deamed
> correct.
>  
> Thanks for taking the time to consider this.

Just to jump in late here, it is worth looking at what
standard example 12 (examples/c/x12c.c) does.  It first plots
a box with default cmap0 colour (red).  Then it does the
following two commands:

plcol0( 2 );
pllab( "Year", "Widget Sales (millions)", "#frPLplot Example 12" );

That first command changes the colour to yellow, and the second plots
those strings in that designated colour.  So far, so good.

Then it goes through a loop which contains calls to plcol1 with
changing argument. Although the loop plot commands include both fills
and text, only the fills seem to be affected by the plcol1 call, _BUT_
the text comes out as red.  I am virtually positive that is a bug
in the core PLplot library.

I suppose one possibility is the text should be in the current
(yellow) cmap0 colour, but I think behind the scenes the two colour
maps are setting the same ultimate colour in two different ways so I
think what should happen here is the text should also be displayed in
the cmap1 colour in that loop.  We need a volunteer to look carefully
at our core colour code to figure this out with a reliable device (
probably anything but the AGG version of wxwidgets, see below).

Interestingly I get the same colour results for both -dev psc and -dev
wxwidgets (both Basic and wxGC).  I tried the two wxwidgets versions
as follows:

examples/c/x12c -dev wxwidgets -drvopt backend=0
examples/c/x12c -dev wxwidgets -drvopt backend=2

(If I try backend=1 to get the AGG version, I get a segfault
presumably because I don't have the AGG library installed, but our
build system and the wxwidgets code should have jointly figured that
out and cleanly dropped the AGG part of the wxwidgets device driver
without creating a segfault so that is a wxwidgets + build system
bug.)

Phil, will you try backend=0 and backend=2 to confirm my consistent
colour results with -dev psc for those and confirm that backend=1 has
inconsistent colour? If you confirm, that means we have just
discovered a total of two bugs in the AGG version, the segfault I just
discovered, and the inconsistent colour results with other devices.

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
__________________________

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
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-d2d
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to