Reputation: 93
I am trying to plot an ECDF by using the following commands But when I run the script I get this error
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
My code is:
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"])
Any ideas?
Upvotes: 0
Views: 233
Reputation: 11565
Correct the Python lists in your call to legend
. For example, fill
should be fill=robj.StrVector(["grey", "red"])
Upvotes: 1