ecdf プロットを生成していて、それに凡例を追加したいのですが、次のエラーが発生します。
plot(xlim=c(0,100), ylim=c(0,1), main=NULL, xaxs="i", yaxs="i",
ecdf(PrecentageVector1), col="red", do.p = FALSE, pch=19,
lwd=3, legend("bottomleft",c("A","B","C")), panel.first = grid())
Error in strwidth(legend, units = "user", cex = cex, font = text.font) :
invalid graphics state
何が問題なのですか?