Dear Rasmus, thanks, that works, too.
Great! Best, Robin On 3/10/21 5:22 PM, Rasmus Liland wrote: > 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 > -- Dr. Robin Haunschild Max Planck Institute for Solid State Research Heisenbergstr. 1 D-70569 Stuttgart (Germany) phone: +49 (0) 711-689-1285 fax: +49 (0) 711-689-1292 email: r.haunsch...@fkf.mpg.de http://www.fkf.mpg.de/ivs Publons: https://publons.com/researcher/2845202/robin-haunschild/ GS: https://scholar.google.de/citations?user=kDfateQAAAAJ&hl=de&oi=ao ______________________________________________ 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.