Wojciech Kowalski
Wojciech Kowalski

Reputation: 31

How plot in gnuplot one curve from multiple data files with modifications?

I want plot in gnuplot one curve using multiple data files in format like this:

dat1.dat

time x y
1 2 3
2 3 4
3 4 5

dat2.dat

time1 x1 y1
4 5 6
5 6 7
6 7 8

I want draw one curve in that way: (time, x) and (time1, x*5) combine together.

I know that I can do something like that:

plot "dat1.dat" using 1:2, \
     "dat2.dat" using 1:($2*5)

and this is nearly what I want to have, but then, I've got two curves with two titles in legend, different colors. I want to have one curve in the single graph with one title in legend.

Upvotes: 1

Views: 190

Answers (1)

Christoph
Christoph

Reputation: 48390

If you want both lines to have the same linetype you must set it explicitely. Also, to have only a single legend, set the title only for the first plot, and unset it for the second plot:

plot "dat1.dat" using 1:2 linetype 1 title "data",\
     "dat2.dat" using 1:($2*5) linetype 1 notitle`

Upvotes: 1

Related Questions