【发布时间】:2020-03-24 02:09:28
【问题描述】:
我想在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')
【问题讨论】:
-
reference是一个数组吗?我认为该行应该类似于plt.hlines(reference, xmin=min(your x axes), xmax=max(your x axes))
标签: pandas matplotlib boxplot