Integration inside a contour plot

261 Views Asked by At

I asked this question on stack overflow (https://stackoverflow.com/q/66852917/7462275) but I am not sure it is the right place. So, I asked it on math exchange.

I have a function : z=f(x,y) and I draw a contour plot.

For example :

import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
x=np.linspace(0,10,11)
y=np.linspace(0,10,11)
X,Y=np.meshgrid(x,y)
Z=(X+4)*(X-14)*(Y+6)*(Y-14)/1000
fig, ax =plt.subplots()
CS= ax.contour(x,x,Z,[7],colors='black')
ax.clabel(CS, inline=True, fontsize=10)

From the contour path data points (CS.collections[0].get_paths()[0]), how is it possible to integrate z inside this area ?

Thanks for answer.