[R] superposing a group of x,y-plot points
Tobias Verbeke
tobias.verbeke at telenet.be
Sat Apr 19 20:06:51 CEST 2008
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
More information about the R-help
mailing list