I'm drawing a chart in Matplotlib , using the plot(x, y) command where x and y are arrays. In the resulting chart I have the first and last point connected by a line. How to avoid the first and last point to be connected ?
I had similar problem as you can see:
BEFORE
I just sorted x
using this:
x = sorted(x)
And the line disappeared as you can see: (But the data is disturbed due to sorting).
AFTER SORTING
You must also make sure the respective y
values should also be accordingly arranged for the sorted x
. The final output is here:
FIXED
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With