To expand on @Dirk Eddelbuettel's answer, you can use any function for col
in the call to plot
. For instance, this colors the x==3
point red, leaving all others black:
x <- 1:5
plot(x, x, col=ifelse(x==3, "red", "black"))
Same goes for point character pch
, character expansion cex
, etc.
plot(x, x, col=ifelse(x==3, "red", "black"),
pch=ifelse(x==3, 19, 1), cex=ifelse(x==3, 2, 1))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…