gnuplot plot points connected by line, nearest point instead

0

I have a number of points out of a countour plot of a circle. Unfortunately the points are ordered by coordinate position. If I plot the data with "lines" as style data, gnuplot draws lines through my circle. However, I only like to have the circle. How I can change the configuration of gnuplot or do I have the change the order of my points?

Tom

Posted 2013-04-25T15:45:12.670

Reputation: 1

2There is no way for gnuplot to know how you like them to be order, so you will have to do some ordering yourself, which can easily be automated. – Bernhard – 2013-06-22T13:56:57.357

Answers

0

As Bernhard commented, this is generally not something you can do easily in Gnuplot. However for your particular issue there's a particular solution.

If the points are ordered say by x-coordinate, you can plot first those with a y-coordinate greater than the y-coordinate of the center of the circle, and then in a separate command those with a lower y-coordinate. E.g, for a center on x-axis:

plot 'data' using 1:(($2>=0)?$2:1/0) with lines lt 1
plot 'data' using 1:(($2<=0)?$2:1/0) with lines lt 1

Connecting the two arcs can be done manually using this answer. It could also be done automatically, you would need to save the first and last occurences (gnuplot 4.4 and greater)

Joce

Posted 2013-04-25T15:45:12.670

Reputation: 637