I've created random points and drawn a graphic with the plot and data. Then I'm saving this figure as a image.
How am I able to do the following?
Sort this random point list , lower coordinates to upper coordinates.
Example list:
[[1,3], [1,2], [1,1]]
Target:
[[1,1], [1,2], [1,3]]
And using the target list as an example:
Index 0 = [1,1] , Index 1 = [1,2] etc.
How can I do math between these indexes like this:Y0 - Y1/ X0 - X1
Here's my code:
import numpy as np
import matplotlib.pyplot as plt
import cv2
points = np.random.randint(0, 9, size=(18,2))
print(points)
plt.plot(points[:,0], points[:,1], '.',color='k')
plt.savefig("graphic.png",bbox_inches="tight")
result = cv2.imread("graphic.png")
cv2.imshow("Result",result)
Graphic drawn with random created points . I'm trying to sort this points lower Y to higher,Y . For example on this graphic you can see minimum coordinate is (1,0) and second minimum coordinate is (7,1) .