0

I have two arrays https://i.stack.imgur.com/2EyfL.png, first one is y coordinates and the second one is x coordinates, when I plot a diagram with these coordinates, it becomes a closed shape like the attached image https://i.stack.imgur.com/rOQ7A.png, I'm asking for a way to calculate the inside area of this closed shape in python.

2 Answers2

0

How to calculate area of an organic shape?

Check out this link, I think it has the same question as you.

Even though it uses another language, you can try and convert it to Python code.

PythonPikachu8
  • 359
  • 2
  • 11
0

Check out the code here: Calculate area of polygon given (x,y) coordinates

def PolyArea(x,y):
    return 0.5*np.abs(np.dot(x,np.roll(y,1))-np.dot(y,np.roll(x,1)))
Iñigo Moreno
  • 529
  • 2
  • 15