I want to calculate the area under this curve for confirmation that the size is correct. How would one go about doing this?
I have a frequency plot below. The package utilized for this median calculation is here: https://github.com/nudomarinero/wquantiles
JavaScript
x
14
14
1
def annot_median(Size,Count, ax=None):
2
xmedian = weighted.median(Size, Count)
3
ymedian = np.interp(xmedian,Size, Count)
4
text="median " + "[{:.2f},{:.0f}]".format(xmedian, ymedian)
5
if not ax:
6
ax=plt.gca()
7
bbox_props = dict(boxstyle="square,pad=0.3", fc="w", ec="k", lw=0.72)
8
arrowprops=dict(arrowstyle="->",connectionstyle="angle,angleA=0,angleB=85")
9
kw = dict(xycoords='data',textcoords="axes fraction",
10
arrowprops=arrowprops, bbox=bbox_props, ha="right", va="top")
11
ax.annotate(text, xy=(xmedian, ymedian), xytext=(0.94,0.86), **kw)
12
13
annot_median(Size,Count)
14
I started with thinking the trapezoid method could be utilized to verify that value
JavaScript
1
4
1
x = Size
2
y = Count
3
Area_t=np.trapz(x[:],y[:])
4
How can I write something so when Area_t = 0.5(total) print corresponding x and y values??