Menu

#1897 set label at x, y, z point lc palette z ignores line color

None
closed-fixed
nobody
None
2017-01-23
2017-01-22
Anonymous
No

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.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2017-01-23

    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.

     
  • Ethan Merritt

    Ethan Merritt - 2017-01-23
    • status: open --> pending-fixed
    • Group: -->
    • Priority: -->
     
  • Ethan Merritt

    Ethan Merritt - 2017-01-23

    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
  • Richard B. Kreckel

    Thanks for the feedback and the workaround!

     
  • Ethan Merritt

    Ethan Merritt - 2017-03-17
    • Status: pending-fixed --> closed-fixed
     

Log in to post a comment.