How can I use a substring of the columnhead for the key? Following simple example:
Code:
### How to get a substring from columnhead?
reset session
$Data <<EOD
ABC.x ABC.y DEF.x DEF.y GHI.x GHI.y
11 21 31 41 51 61
12 22 32 42 52 62
13 23 33 43 53 63
14 24 34 44 54 64
15 25 35 45 55 65
EOD
set key top left
plot for [i=1:5:2] $Data u i:i+1 w lp title columnhead(i)
### end of code
Result:
I could use these two syntax variations:
... title columnhead
... title columnhead(i)
Now, however, I want to skip the .x
in the legend.
None of the following works:
... title columnhead[1:3]
... title columnhead(i)[1:3]
... title substr(columnhead,1,3)
... title substr(columnhead(i),1,3)
... title sprintf("%s",columnhead)[1:3]
... title sprintf("%s",columnhead(i))[1:3]
... title (sprintf("%s",columnhead(i))."")[1:3]
... title (tmp=columnhead(i),tmp[1:3])
With most of these variations you will get the following result:
Result:
Question: Why is this? How to workaround?