您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何使用python绘制Friedman-Nemenyi检验的结果

如何使用python绘制Friedman-Nemenyi检验的结果

为了重现上面的图,您可以将普通图的3个棘刺设置为不可见,然后将相应的元素添加到图中。

在此处输入图片说明

import matplotlib.pyplot as plt

# input data
cd = 1.2
c = 3.2
ccf = 2.8
cmcf = 1.9
cm = 2.05

limits=(4,1)

fig, ax = plt.subplots(figsize=(5,1.8))
plt.subplots_adjust(left=0.2, right=0.8)

# set up plot
ax.set_xlim(limits)
ax.set_ylim(0,1)
ax.spines['top'].set_position(('axes', 0.6))
#ax.xaxis.tick_top()
ax.xaxis.set_ticks_position('top')
ax.yaxis.set_visible(False)
for pos in ["bottom", "left", "right"]:
    ax.spines[pos].set_visible(False)

# CD bar
ax.plot([limits[0],limits[0]-cd], [.9,.9], color="k")
ax.plot([limits[0],limits[0]], [.9-0.03,.9+0.03], color="k")
ax.plot([limits[0]-cd,limits[0]-cd], [.9-0.03,.9+0.03], color="k") 
ax.text(limits[0]-cd/2., 0.92, "CD", ha="center", va="bottom")

# annotations
b@R_69_2419@_props = dict(@R_69_2419@style="square,pad=0.3", fc="w", ec="k", lw=0.72)
arrowprops=dict(arrowstyle="-",connectionstyle="angle,angleA=0,angleB=90")
kw = dict(xycoords='data',textcoords="axes fraction",
          arrowprops=arrowprops, b@R_69_2419@=b@R_69_2419@_props, va="center")
ax.annotate("C4.5", xy=(c, 0.6), xytext=(0,0.25),ha="right",  **kw)
ax.annotate("C4.5+cf", xy=(ccf, 0.6), xytext=(0,0),ha="right",  **kw)
ax.annotate("C4.5+m+cf", xy=(cmcf, 0.6), xytext=(1.,0.25),ha="left",  **kw)
ax.annotate("C4.5+m", xy=(cm, 0.6), xytext=(1.,0),ha="left",  **kw)

#bars
ax.plot([ccf,c],[0.55,0.55], color="k", lw=3)
ax.plot([ccf,cmcf],[0.48,0.48], color="k", lw=3)

plt.show()
python 2022/1/1 18:28:26 有249人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶