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
def annot_median(Size,Count, ax=None): xmedian = weighted.median(Size, Count) ymedian = np.interp(xmedian,Size, Count) text="median " + "[{:.2f},{:.0f}]".format(xmedian, ymedian) if not ax: ax=plt.gca() bbox_props = dict(boxstyle="square,pad=0.3", fc="w", ec="k", lw=0.72) arrowprops=dict(arrowstyle="->",connectionstyle="angle,angleA=0,angleB=85") kw = dict(xycoords='data',textcoords="axes fraction", arrowprops=arrowprops, bbox=bbox_props, ha="right", va="top") ax.annotate(text, xy=(xmedian, ymedian), xytext=(0.94,0.86), **kw) annot_median(Size,Count)
I started with thinking the trapezoid method could be utilized to verify that value
x = Size y = Count Area_t=np.trapz(x[:],y[:])
How can I write something so when Area_t = 0.5(total) print corresponding x and y values??