MyUserIsThis
MyUserIsThis

Reputation: 437

Plotting with gnuplot from several files

I have several files called data_x.dat, where x ranges from 1 to 10. I'm looking for something in gnuplot that would allow me to directly plot the second column agains the first one of all of the files in the same graph, instead of doing

p "data_1.dat" u 1:2, "data_2.dat" u 1:2, ..., "data_10.dat" u 1:2

which is slow to type. Something like:

p "data_*" u 1:2

is what I'm looking for. Does it exist for gnuplot?.

Thank you.

Upvotes: 0

Views: 346

Answers (1)

Christoph
Christoph

Reputation: 48390

Use inline iterations:

plot for [i=1:10] sprintf("data_%d.dat", i) u 1:2

Upvotes: 1

Related Questions