Re: [R] Color in stripchart

2021-03-11 Thread Rasmus Liland
Good for you! __ 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, r

Re: [R] Color in stripchart

2021-03-10 Thread Dr. Robin Haunschild
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 > ac

Re: [R] Color in stripchart

2021-03-10 Thread Rasmus Liland
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, re

Re: [R] Color in stripchart

2021-03-10 Thread Dr. Robin Haunschild
Dear Gerrit, thanks a lot; it works with beeswarm and pwcol=df$color. Best, Robin On 3/10/21 3:04 PM, Gerrit Eichner wrote: > Dear Robin, > > if you study stripchart's code (graphics:::stripchart) carefully > you will find out that the elements of the vector provided to the > col-argument (and

Re: [R] Color in stripchart

2021-03-10 Thread Dr. Robin Haunschild
Dear Rasmus, there is no difference in the small exmaple, because there is only one point per year. If you use the example with multiple points per year, you will see the difference. Best, Robin On 3/10/21 3:15 PM, Rasmus Liland wrote: > Dear Robin and Gerrit, > > I am unable to see the diffe

Re: [R] Color in stripchart

2021-03-10 Thread Rasmus Liland
Dear Robin and Gerrit, I am unable to see the difference in the plot in the two cases ... df <- data.frame(year = seq(2011, 2018), value = seq(10, 80, 10)) df$color <- 'black' df[df$value<33,]$color <- 'blue' df[df$value>66,]$color <- 'red' file

Re: [R] Color in stripchart

2021-03-10 Thread Gerrit Eichner
Dear Robin, if you study stripchart's code (graphics:::stripchart) carefully you will find out that the elements of the vector provided to the col-argument (and the pch-argument as well) are selected by iterating along the groups (in your case year). I don't seen easy solution for your problem us

[R] Color in stripchart

2021-03-10 Thread Dr. Robin Haunschild
Dear fellow R users, I'd like to color individual points in a stripchart. This works well as long as I have only a single value per y axis category: df <- data.frame(year = seq(2011, 2018), value = seq(10,80, 10)) df$color <- 'black' df[df$value<33,]$color <- 'blue' df[df$value>66,]$color <- 'red