Denis Ladeira - 2023-07-06

Problem with palette colors, what am I missing?

I have some data to plot in Gnuplot, however I am finding a problem in the palette colors. Maybe this problem has been addressed before, but I did not find a solution after searching the web...

I isolated the problem and below are the script and a data file. The output is atached.

Script:

#test.gp
set rmargin at screen 0.78
set lmargin at screen 0.25
set terminal postscript eps color enhanced "Helvetica" 30
set output 'test.eps'
#...
set xrange [0:2*pi]
set mxtics 2
set xtics ('0' 0, '' pi/2,'{/Symbol-Oblique p}' pi, '' 3*pi/2, '2{/Symbol-Oblique p}' 2*pi)
#...
set yrange [0:30]
set mytics 2
set ytics 4
#...
set cbrange [-0.5:28.5]
set cbtics norangelimit 5
#...
set cblabel "{/Symbol-Oblique w}" #label da paleta de cores
set xlabel "{/Symbol-Oblique f}"
set ylabel "{/Symbol-Oblique z}"
#...
set palette maxcolors 29
set palette defined (0 "yellow",\
                     1 "beige",\
                     2 "lemonchiffon",\
                     3 "dark-red",\
                     4 "dark-orange",\
                     5 "red",\
                     6 "light-red",\
                     7 "orange-red",\
                     8 "sienna1",\
                     9 "tan1",\
                     10 "dark-violet",\
                     11 "dark-magenta",\
                     12 "mediumpurple3",\
                     13 "purple",\
                     14 "dark-pink",\
                     15 "magenta",\
                     16 "light-magenta",\
                     17 "orchid",\
                     18 "pink",\
                     19 "orchid4",\
                     20 "dark-green",\
                     21 "forest-green",\
                     22 "web-green",\
                     23 "midnight-blue",\
                     24 "navy",\
                     25 "medium-blue",\
                     26 "blue",\
                     27 "royalblue",\
                     28 "web-blue")
#...
unset key
plot 'test.dat' using 1:2:3 with points pointtype 7 pointsize 1 lc palette

Data file (test.dat):

3.141592654   1     0
3.141592654   2     1
3.141592654   3     2
3.141592654   4     3
3.141592654   5     4
3.141592654   6     5
3.141592654   7     6
3.141592654   8     7
3.141592654   9     8
3.141592654   10    9
3.141592654   11    10
3.141592654   12    11
3.141592654   13    12
3.141592654   14    13
3.141592654   15    14
3.141592654   16    15
3.141592654   17    16
3.141592654   18    17
3.141592654   19    18
3.141592654   20    19
3.141592654   21    20
3.141592654   22    21
3.141592654   23    22
3.141592654   24    23
3.141592654   25    24
3.141592654   26    25
3.141592654   27    26
3.141592654   28    27
3.141592654   29    28

In the script the value z=10 is dark-violet. In the plot the corresponding data point has the correct color. However in the palette of the plot both z=9 and z=10 are tan1. Please, what am I missing?

In cbrange I wish [-0.5:28.5] because in this way the cbtics are centered (centred) at 5, 10, 15, etc. I would like also a discrete colors palette because the values of z are discrete and in the actual data I have the discrete colors scheme improves the visualisation.

$ gnuplot --version
gnuplot 5.4 patchlevel 2

Thank you!
(Greetings from Brazil)