Line between first and last point

I draw a diagram using the plot (x, y) command, where x and y are arrays. In the resulting diagram, I have the first and last point connected by a line. How to avoid connecting the first and last points?

+4
source share
1 answer

I had a similar problem, as you can see:

BEFORE enter image description here

I just sorted xusing this:

x = sorted(x)

And the line disappeared, as you can see: (But the data is distorted due to sorting).

AFTER SORTINGenter image description here

You must also ensure that the corresponding values ymust also be properly ordered for the sorted one x. The final result is here:

enter image description here

0

All Articles