x=cbind(1:4,3:6) png('one_point.png') plot(x[1:3,],xlim=c(-1,11),ylim=c(-1,11),pch=1) points(x[4,],pch=2)# this is plotted as two points #although I meant only one point legend("topleft", c("x","y"),pch=c(1,2)) dev.off()
The above code will produce 5 points instead of 4 points. If I want to have 4 points, I have to use the following code. But the below code is a little bit tedious. I'm wondering if there is a way that I still use the above code (with a little change) to generate 4 points? x=cbind(1:4,3:6) png('one_point_split.png') plot(x[1:3,1],x[1:3,2],xlim=c(-1,11),ylim=c(-1,11),pch=1) points(x[4,1],x[4,2],pch=2) legend("topleft", c("x","y"),pch=c(1,2)) dev.off() ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.