我正在尝试使用以下命令绘制ECDF 但是当我运行脚本时,我得到了这个错误
1: In rect(left, top, r, b, angle = angle, density = density, ...) :
supplied color is not numeric nor character
2: In rect(left, top, r, b, angle = angle, density = density, ...) :
supplied color is not numeric nor character
我的代码是:
import rpy2.robjects as robj
ce=robj.FloatVector(range(1,100,1))
le=robj.FloatVector(range(5,500,2))
label="score"
l1="a"
l2="b"
robj.r["plot.ecdf"](ce,main="",verticals=True,pch=46,col="grey",xlab=label)
robj.r["plot.ecdf"](le,verticals=True,pch=46,col="red",add=True)
robj.r.legend("topleft",legend=[l1,l2],fill=["grey","red"])
有什么想法吗?
答案 0 :(得分:1)
在调用legend
时更正Python列表。例如,fill
应为fill=robj.StrVector(["grey", "red"])