Hello there again, Sorry, I missed that part in the middle about set.seed. As per [1], you need to run stripchart again with the add argument set to TRUE, and slicing the df according to the color, like so
set.seed(20210310) years <- sample(x=seq(2011, 2018), size = 365*8, replace = TRUE) values <- sample(x=seq(0,100), size = 365*8, replace = TRUE) df <- data.frame(year = years, value = values) df$color <- 'black' df[df$value<33,]$color <- 'blue' df[df$value>66,]$color <- 'red' stripchart(value ~ year, pch=18, method='stack', data=df) for (color in unique(df$color)) { stripchart(value ~ year, pch=18, method='stack', data=df[df$color==color,], col=color, add=TRUE) } Best, Rasmus [1] https://stackoverflow.com/questions/32833210/define-color-for-each-datapoint-in-a-stripchart-separately
signature.asc
Description: PGP signature
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.