If I have the following text file:
#text.dat 1 4 #green 2 11 #yellow 3 40 #red
It would be nice to be able to do something like:
set palette defined (0 "green", 10 "yellow", 20 "red") set palette maxcolors 3 plot 'test.dat' using 1:2:2 with boxes palette
At the present (tested on gnuplot4.6.0, OS-X 10.5.8), this doesn't work because gnuplot creates a palette as defined above and then partitions it into 3 separate sections (0-15 is green, 15-30 is yellow, 30-45 is red) which isn't what I asked for in my palette definition. Of course there are numerous workarounds, but they all involve re-mapping the 2nd column using a ternary operator in the using spec (which gets tedious very quickly as the number of colors grows), or adding color information to the datafile and doing some sort of loop:
plot for [color in "green red yellow"] 'test.dat' using 1:(strcol(3) eq color ? $2:NaN):(0.95) with boxes
I'm not saying that palette maxcolors should be overloaded for this purpose -- I just used it as an example as it is the closest thing that I know of that gnuplot currently has to do this task -- but it would be nice if there were some way to set the boundaries for the discrete colors in a palette mapping.
Anyway, thanks for the great work and sorry if this request has been made/turned down before.
Log in to post a comment.