Dear all, I need to generate plots in which the points of the plot are replaced by text labels, such as "dog" and "cat". The usual way of specifying the plotting symbol with pch works only if the labels are single characters, as far as I know. So,
plot(runif(3), pch=c("A", "B", "C")) will work OK, but plot(runif(3), pch=c("dog", "cat", "mouse")) won't - it will simply use the first character of each string as the plotting symbol ("d", "c", and "m"). The easiest solution that I found (but there may be an easier one) is to generate the plot but to omit the points (by specifying type="n"), and then later adding the labels with the text() function. Hence, the following does what I want: a <- runif(3) plot(a, type="n") text(a, labels = c("dog", "cat", "mouse")) Here is the problem - I need to do this in a Trellis plot. So, something like library(lattice) stripplot(a ~ b | c) The question is how to get the points replaced by the text labels. Certainly the following works, and generates an empty Trellis plot: stripplot(a ~ b | c, type="n") but now I can't seem to figure out how to use the text() function to add in the labels, specifically, how to implement the "by c" part. Any help would be greatly appreciated! M Damian ______________________________________________ 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.