well, for a simple stripchart (i.e., default method) you can use something like the following:

x <- rnorm(9)
cl <- c(1,1,1,2,2,2,3,3,3)

plot(range(x), c(0, 1), type = "n", yaxt = "n", ann = FALSE)
points(x, rep(0.5, length(x)), pch = cl)


I hope it helps.

Best,
Dimitris


Sam Player wrote:
If I have a dataset grouped into 3 classes, how can I construct a stripchart where the markers are different for each class, e.g. a cross for 1, square for 2 and circle for 3. In the example below I try to define the marker type by the class but this only changes all the markers from the default squares into circles. I am assuming I need to set pch as an argument in par but am unsure how to proceed.

data <- rnorm(9)
class <- c(1,1,1,2,2,2,3,3,3)
x <- data.frame(data,class)
stripchart(x[,1], pch=x[,2])

Thanks,

Sam.

______________________________________________
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.


--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

______________________________________________
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.

Reply via email to