sethu
sethu

Reputation: 1721

gnuplot - removing line title

I tried searching, but I couldn't find the solution for this particular condition. In my plot , I am comparing two traces. I am using a line graph and both traces are plotted with different colors.

plot "delay_try1.dat" using 1:2 title 'With CloneScale' with lines, \
     "normal_2.dat" using 1:2 title "Without CloneScale" with lines lc rgb "black", \
     "normal2.dat" using 1:2 title 'Without CloneScale' with lines lc rgb "black"

Using this plot command, I get 3 titles in legends and 2 are repeating ones. I just want 2 titles to appear and remove the repeating one. Is it possible to do this?

Upvotes: 39

Views: 98081

Answers (3)

hertzsprung
hertzsprung

Reputation: 9893

If you had more untitled lines than titled lines, it's more convenient to disable titles by default using set key noautotitle:

set key noautotitle

plot "delay_try1.dat" using 1:2 title 'With CloneScale' with lines, \
     "normal_2.dat" using 1:2 title "Without CloneScale" with lines lc rgb "black", \
     "normal2.dat" using 1:2 with lines lc rgb "black"

Upvotes: 5

Mattias
Mattias

Reputation: 9471

To accomplish this you should use the notitle tag.

plot "delay_try1.dat" using 1:2 title 'With CloneScale' with lines, "normal_2.dat" using 1:2 title "Without CloneScale" with lines lc rgb "black", "normal2.dat" using 1:2 with lines lc rgb "black" notitle

or a more general example;

plot 'File.dat' using 1:2 notitle

an alternative that is equivalent to notitle is to set the title to a zero character string;

plot 'File.dat' using 1:2 title ""

Upvotes: 62

jstarek
jstarek

Reputation: 1542

If you are not above a bit of trickery:

Just omitting the last "Without CloneScale" title will remove both title and line from the legend. Setting the last title to a space will show the line and (seemingly) nothing before it in the legend:

plot "delay_try1.dat" using 1:2 title 'With CloneScale' with lines,"normal_2.dat" using 1:2 title "Without CloneScale" with lines lc rgb "black", "normal2.dat" using 1:2 title ' ' with lines lc rgb "black"

Upvotes: -2

Related Questions