How to set custom tics labels with different colours? Now, I getting an error: undefined variable: tc
set ytics ("1" 1.0 tc rgb 'purple', "0.8" 0.8 tc rgb 'purple', "1" 1.4 tc rgb 'forest-green', "0.8" 1.2 tc rgb 'forest-green', "1" 1.8 tc rgb 'black', "0.8" 1.6 tc rgb 'black')
set y2tics ("1" 1.2 tc rgb 'blue', "0.8" 1.0 tc rgb 'blue', "1" 1.6 tc rgb 'red', "0.8" 1.4 tc rgb 'red', "1" 2.0 tc rgb 'brown', "0.8" 1.8 tc rgb 'brown')
As far as I know, you can set the color of the tics per axis (check help xtics
), but not individually. So you have to do it semi-manually. One way would be for example via drawing arrows. Maybe depending on the full picture/context there might be other solutions.
Edit: adding custom colored ticlabels as well
Script:
### set custom & colored tics
reset session
$TicsY <<EOD
0.8 0.8 purple
1 1.0 purple
0.8 1.2 forest-green
1 1.4 forest-green
0.8 1.6 black
1 1.8 black
EOD
$TicsY2 <<EOD
0.8 1.0 blue
1 1.2 blue
0.8 1.4 red
1 1.6 red
0.8 1.8 brown
1 2.0 brown
EOD
set link y2 via y inverse y
unset ytics
set for [i=1:|$TicsY|] arrow i from graph 0.02, first y0=word($TicsY[i],2) to graph 0, first y0 nohead lw 2 lc rgb word($TicsY[i],3)
set lmargin 5
set for [i=1:|$TicsY|] label i word($TicsY[i],1) at graph -0.05, first word($TicsY[i],2) tc rgb word($TicsY[i],3)
unset y2tics
set for [i=1:|$TicsY2|] arrow i+|$TicsY| from graph 0.98, second y0=word($TicsY2[i],2) to graph 1, second y0 nohead lw 2 lc rgb word($TicsY2[i],3)
set rmargin 5
set for [i=1:|$TicsY2|] label i+|$TicsY| word($TicsY2[i],1) at graph 1.02, first word($TicsY2[i],2) tc rgb word($TicsY2[i],3)
plot [0.5:2.5] x
### end of script
Result: