How can multicolor labels be realized in gnuplot? Apparently, the enhanced text modus offers parameters like font, fontsize, bold, italics, etc. but not colors. The following workaround is adapted from here.
It splits the label into as many labels as colors you have and uses the enhanced text function &{space} which inserts empty space of the length of space.
Are there maybe better ways?
Code:
### multicolor labels
reset session
Text1 = "One"; Color1 = "red"
Text2 = "Two"; Color2 = "green"
Text3 = "Three"; Color3 = "blue
Text4 = "Four"; Color4 = "magenta"
Text5 = "Five"; Color5 = "cyan"
Text6 = "Six"; Color6 = "yellow"
PosX=0
PosY=0
set label 1 Text1 at PosX,PosY tc rgb Color1
set label 2 sprintf("&{%s}%s",Text1,Text2) at PosX,PosY tc rgb Color2
set label 3 sprintf("&{%s%s}%s",Text1,Text2,Text3) at PosX,PosY tc rgb Color3
set label 4 sprintf("&{%s%s%s}%s",Text1,Text2,Text3,Text4) at PosX,PosY tc rgb Color4
set label 5 sprintf("\n%s",Text5) at PosX,PosY tc rgb Color5
set label 6 sprintf("\n&{%s}%s",Text5,Text6) at PosX,PosY tc rgb Color6
plot x
###end of code
Result: (actually, with set terminal wxt font ",20")

