This question comes from another question: Different coloring of groups in R plot
I'd like to elarn to change the hue of one geom without affecting another. So here the boxplot grouping and point grouping map to the same variable. Changing the hue for one changes the other. How could I change the hue for the box fill but not the point fill; in other words make the point fill lighter in color so they stand out against the same color of the box fill?
#Data
library(RColorBrewer)
library(reshape2)
a=rnorm(100, mean=1)
b=rnorm(100, mean=0, sd=1)
ab=data.frame(a,b)
melt=melt(ab)
bpColor=brewer.pal(4, 'RdBu')
#Current
ggplot(melt, aes(fill=variable, x=variable, y=value)) +
geom_boxplot(notch = TRUE) +
geom_jitter(position = position_jitter(width = .05, height =0), shape=21, size=1.5) +
scale_fill_hue(l=40)
It may be simpler to create a boxplot and then a pointplot with a lighter hue, and overlay the points over the boxes. Borrowing the ideas from this post, let me illustrate: