I need to construct a discrete palette color with only a few colors, say:
set palette defined (0 'red', 1 'red', 1 'green',\
2 'green', 2 'blue', 3 'blue',\
3 'yellow', 4 'yellow')
which will be applied a specific number of times to a unique matrix data-file, i.e., by recycling the palette. Suppose the matrix data-file ranges integers data from 0 up to 16. The palette will be applied four times: first, for data in [0:4]
; second, for [4:8]
, third, for [8:12]
and fourth, for [12:16]
. The final result I expect is a heat map (2D image) with four colors.
I have tried the following palette:
set palette defined ( (k%4==0)'red', (k%4==1)'red',\
(k%4==1)'green', (k%4==2)'green',\
(k%4==2)'blue', (k%4==3)'blue',\
(k%4==3)'yellow',(k%4==4)'yellow' )
where 'k' is the element of matrix data-file. My problem is to define 'k'. Of course, it can be done by some coding on the data-file but I will lose original information.
Is there any way to define such "recycling palette"?