Re: [R] superposing a group of x,y-plot points

From: Tobias Verbeke <tobias.verbeke_at_telenet.be>
Date: Sat, 19 Apr 2008 20:06:51 +0200

Anna-Maria Tyrisevä wrote:

> please, could somebody tell me how can I superpose a group of x,y-plot
> points (using different symbols) that belong to a certain class of factor z?
> Can't find a solution despite of hours of reading.

x <- rnorm(30)
y <- rnorm(30)
f <- factor(sample(LETTERS[1:5], 30, replace = TRUE))
plot(x, y, type = "n")
# different plot character for different factor level points(x, y, pch = c(3, 9, 19, 20, 13)[as.numeric(f)])

# different colour for different factor level plot(x, y, type = "n")
points(x, y, col = as.numeric(f), pch = 19)

HTH,
Tobias



R-help_at_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. Received on Sat 19 Apr 2008 - 18:17:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 19 Apr 2008 - 19:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive