df <- data.frame(subject = sort(rep(c(1:85), 8)), number = rep(c(rep(c("singular"),4),rep(c("plural"),4)),85), modifier = rep(c(rep(c(rep(c("no_mod"),2),rep(c("mod"),2)),2)),85), null_overt = rep(rep(c("null","overt"),4),85), timing = c(rep(c("timed1"),8*25),rep(c("timed2"),8*30),rep(c("untimed"),8*30)), measure = rnorm(8*85), sd = abs(rnorm(8*85))/10 )
I have four discrete factors – number, modifier, null_overt, and timing – all within-subjects except for timing.
I would like to show the interactions between factors; however, there is quite a bit of individual variation not only in participant means, but also in participant response consistency (4 responses per condition).
The data here is just the means, since there are 8 means for each participant – far too many data points to show individual responses.
I want to plot each mean by the DV “measure” and have each point colored based on the standard deviation for that mean.
For example, if a participant gave the responses “1 1 1 1” then that point would be plotted at 1 on the y axis and colored in with the color corresponding to 0 for the standard deviation, while a participant who responds 1 1 .5 .5 is plotted at .75, and colored in with the color corresponding to .289.
The closest I’ve gotten is the following 2 attempts:
ggplot(data=df, aes(x = modifier, y = measure, fill = null_overt, color = sd))+ geom_dotplot(stat="identity", position = position_dodge(), dotsize=.8, binaxis='y',stackdir='center')+ facet_grid(number~timing) ggplot(data=df, aes(x = modifier, y = measure, fill = null_overt, color = sd))+ geom_point(data=df, position=position_dodge(width=0.8),size=5)+ facet_grid(number~timing)
The first one gets the dots in the configuration that I want, but does not include the sd color (I have tried this with different factor names as well, other than “sd”), along with the warning “Ignoring unknown parameters: stat” – I assumed this has something to do with not including the color:
The second one gets the right kind of color scale, but the dots are overlapping, and I would prefer a solution other than jittering them randomly – ideally I would like them to be in a grid configuration like in graph 1:
Is there any way of changing the colors in graph 1, or the dot configuration in graph 2, or another solution? Thanks in advance!