Ecterion
Ecterion

Reputation: 161

gnuplot single title in loop structure

How can you assign only one title to a line when you also use a for loop?

I have the follwoing command line:

plot for [i=1:15] "test.txt" using (i-1):i title "test" lc rgb "red" ps 0.4 lw 0.5

But the title is of course repeated 15 times. I would like the title to appear only for one time. Is there a way to avoid this without using label? I have searched but nothing looks interesting.

Upvotes: 1

Views: 409

Answers (1)

Christoph
Christoph

Reputation: 48440

Empty titles are omitted. Simply check variable i:

plot for [i=1:15] "test.txt" using (i-1):i title (i == 1 ? "test" : "")

Upvotes: 2

Related Questions