Overwriting color in graph based on value of a string

Overwriting color in graph based on value of a string

Post by mari » Sat, 17 Mar 2007 05:18:30


Hi,

I have a script which creates a basic columnstacked histogram:

set grid nopolar
set boxwidth 0.9 relative
set style data histograms
set style histogram columnstacked
set style fill solid 1.0 border -1
plot 'testArray.dat' using 1, '' using 3, '' using 5


which creates a stacked histogram from a data file:


15.00 YES 03.00 NO 06.00 YES
14.00 YES 05.00 NO 02.00 NO
03.00 YES 02.00 YES 01.00 YES


This works. However I want the color of each box to depend on the
value of the string in the next column and not which row it came from.
i.e:
I want the color of the box for 15.00 (row 0 col 0) to be green
because the next col (row0 col)1 is "YES".
and I want the color of the box for 03.00 (row0 col1) to be red
because the next col (row0 col3) is "NO".

Does anyone know is there anyway to overwrite the color settings for
this??

Thanks so much,
Marie
 
 
 

Overwriting color in graph based on value of a string

Post by Mike Deske » Sat, 17 Mar 2007 12:43:26

how about modifying your data so that it's nominally 6 columns - one
yes and one now for each of your three options.

so here's what i'd make your data look like
15.00 00.00 00.00 03.00 06.00 00.00
14.00 00.00 00.00 05.00 00.00 02.00
03.00 00.00 02.00 00.00 01.00 00.00

so now column 1 is "YES" for option 1 and column 2 is "NO" for option
1, and so on.

now you can just make a stacked histogram with 6 bars, but you'll only
ever see three because the zeros will be invisible.