four = "4" graph4 = "Title for plot #4" graph(n) = sprintf("Title for plot #%d",n)
plot 'data.4' title "Title for plot #4" plot 'data.4' title graph4 plot 'data.4' title "Title for plot #".four plot 'data.4' title graph(4)
Since integers are promoted to strings when operated on by the string concatenation operator ('.' character), the following method also works:
N = 4 plot 'data.'.N title "Title for plot #".N
In general, elements on the command line will only be evaluated as possible string variables if they are not otherwise recognizable as part of the normal gnuplot syntax. So the following sequence of commands is legal, although probably should be avoided so as not to cause confusion:
plot = "my_datafile.dat" title = "My Title" plot plot title title