Reputation: 8694
How is it possible with gnuplot to plot both isolated points and lines for the same input file?
I mean, once I have a file data.dat
of this kind that defines two lines 1-2 and 3-4
x1 y1
x2 y2
x3 y3
x4 y4
I can plot the lines with
$> plot 'data.dat' w lp
but if I want to also add some isolated points to be displayed with gnuplot I would like to add to my data.dat
file the following
x1 y1
x2 y2
x3 y3
x4 y4
x5 y5
x6 y6
x7 y7
obviously the points 5,6,7 are treated by gnuplot as points of a line. How can I draw 5,6,7 as isolated points?
Upvotes: 1
Views: 46432
Reputation: 2000
Organize your data in blocks. There should be exactly one empty line between two blocks:
x1 y1
x2 y2
x3 y3
x4 y4
x5 y5
x6 y6
x7 y7
Use every
to specify which blocks of the datafile should be plotted. The syntax of every is described here or in gnuplot (type help every
)
In your case you can then do the following
plot "data.txt" every :::0::1 with lp, "" every :::2::2 with points
Upvotes: 3
Reputation: 1588
if it's acceptable to plot point symbols for points 1..4, too, then just add empty lines after points 5 and 6 and say
plot "1.dat" with lines, "" with points
if not, I'd suggest writing the isolated points to a separate file.
Upvotes: 1