4

I have a data file like in four columns representing x1, y1, x2, y2.

e.g

1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7

etc.

Now I want to plot line segments using (x1,y1) and (x2,y2) as end points of the line segments. Thus I shall get 4 line segments from the above data file.

How can I achieve this using gnuplot ?

2 Answers 2

13

You can simply do

dataf = 'yourfilename.dat'
plot dataf using 1:2:($3-$1):($4-$2) with vectors nohead

without changing your original data file.

Sign up to request clarification or add additional context in comments.

Comments

0

You can do this easily.

1 2
3 4

2 3
4 5
...

does this. You just need to add an extra line between each set of cordinates.

Hope this hepls.

2 Comments

@FlorianPrud'homme no idea
perhaps, the guy wanted a plot command like : "plot 'filename' with linespoints ls 1"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.