The help text tries to explain this. columnhead(x)
is a string-valued function. As such it can be composed or combined with other functions.
gnuplot> help columnhead
`columnhead(x)` may only be used as part of a plot, splot, or stats command.
It evaluates to a string containing the content of column x in the first line
of a data file. See `plot datafile using`.
Note that this function can be used anywhere in the plot command, not just as a title option. For a contrived example:
plot DATA using 1:2:(columnhead(3)) with labels
By contrast the keyword columnheader
is valid only as a title option. The common use is as an option to the set key
command in the form
set key autotitle columnheader
where it would affect all plot components generated from data files (as opposed to functions). As a convenience it is also allowed as a title substitute for a single plot component, as in
plot DAT1 using 1 title "foo", DAT2 using 2 title "baz", DAT3 using 3 title columnheader
A drawback of this is that the program has to guess which column is meant. It is unambiguous in the example above, but consider:
plot DAT3 using ($2+$3)/($4) title columnheader # _which_ columnheader?
So as a special case the program looks to see if a particular column in parentheses immediately follows the keyword. I.e. it looks like a function but isn't really. The program could be smarter and realize that it could use the actual function columnhead()
, but unfortunately it isn't that smart.