我有一个熊猫数据框,我需要从中绘制一个带有标记的线图。为此,我将数据帧转换为一个透视表,其中index= "Distance", columns= "system", values= "fscore"
。使用下面代码段中使用的plot
方法,我可以得到如下所示的线图。但是,如何根据lenth
列中的值(或lenth
列中的值的标准化分数)改变标记大小
代码段:
plotPD = df.pivot(index="Distance", columns="system", values="fscore").fillna(0)
ax = plotPD.plot(
marker="H",
title="plotTitle",
xticks=(range(0, len(plotPD.index) + 2, 2)),
yticks=np.arange(0, 1.1, 0.1),
)
ax.set_xlabel(plotPD.index.name, fontsize=14)
原始数据帧distPD
system Distance lenth summ fscore
0 L2S 12 45 31 0.688889
1 L2S 9 84 52 0.619048
2 L2S 1 1685 1471 0.872997
3 L2S 2 578 403 0.697232
4 L2S 13 47 30 0.638298
279 BiAFF 17 9 8 0.888889
280 BiAFF 19 7 5 0.714286
281 BiAFF 21 5 5 1.000000
282 BiAFF 20 4 4 1.000000
283 BiAFF 26 2 2 1.000000
您可以考虑没有标记的^ {CD1>},并用^ {< CD3>}选项添加^ {< CD2>}图:
相关问题 更多 >
编程相关推荐