Samanosuke Akechi
Samanosuke Akechi

Reputation: 361

Connect title of each plot with the do loop variable

I am using the following line in gnuplot to plot 4 graphs from the file rdf.xvg

plot for [n=2:5]  "rdf.xvg" u 1:n  ti 'graph'.n.' wL=0.25'

The problem is at the title. I want the title of each graph to say

"graph LL wL=0.25"
"graph RR wL=0.25"
"graph LR wL=0.25"
"graph To wL=0.25"

I think the solution is the connection of n variable with the LL, RR, LR, To with an if statement like

if n=2 then ti 'graph LL wL=0.25' etc

Is it possible?

Upvotes: 1

Views: 250

Answers (1)

Christoph
Christoph

Reputation: 48390

Just define a string which contains the different words. You can access them using the word function (first word is index with 1):

labels = "LL RR LR To"
plot for [n=2:5]  "rdf.xvg" u 1:n  ti 'graph '.word(labels, n-1).' wL=0.25'

Upvotes: 1

Related Questions