我想添加一条水平线,即 中的“参考” boxplot。我尝试了以下代码,但它没有按预期工作。
df=pd.DataFrame({"Prior": initial_FOPR,
"DSI": pca_FOPR,
"DSI.ESMDA": ksvd_FOPR,
"DSI.ESMDA.LOC": dct_FOPR,"ES-MDA": Basic_FOPR,})
df.boxplot(grid=False, rot=45, fontsize=15)
plt.hlines(reference,xmin=min(reference),xmax=max(reference),'r')
Run Code Online (Sandbox Code Playgroud)