Consider this script:
set palette defined(-10 'web-green', 0 'goldenrod', 10 'red')
do for [i=-8:8:2] {
set label at i, 8, i "X" textcolor palette z point pt 4 lc palette z
}
plot x notitle
Running it shows that palette z works for textcolor but not for line color: all the boxes have the same color (apparently the one at palette 0). I'm using gnuplot 5.0 patchlevel 5.
The problem here is that the program doesn't think to look at the z value of the label to find the "current z" referred to by the color specification. Probably it should, but meanwhile you can bypass this by attaching the z value directly to the color also:
set label at i, 8, i "X" textcolor palette z point pt 4 lc palette cb i
This stuffs the z value ("i" in this case) into the colorspec as well as the label coordinates.
In other words
"palette z" means use the current z value to index the colorbox, but current z value in a 2D plot is a bit problematic
"palette cb <val>" means use the colorbox mapping for <value> independent of the current z.
Fixed in cvs for 5.0 and 5.1
The work-around "palette cb <z-value>" works for both even without the fix.
Last edit: Ethan Merritt 2017-01-23
Thanks for the feedback and the workaround!