[R] superpose violin and boxplot in ggplot

PIKAL Petr petr.pikal at precheza.cz
Wed Sep 11 14:50:30 CEST 2013


Dear all

I am struggling a bit with tricky violinplot. I found how to superpose boxplots correctly to violinplots.

p<-ggplot(Cars93, aes(x=Origin, y=Price, fill=Type, colour=Type))
p+geom_violin()+ geom_boxplot(aes(fill=NULL), position=position_dodge(width=.9), width=.3)

but if I wanted to change the boxplot to black colour I am lost

p+geom_violin()+ geom_boxplot(aes(fill=NULL), position=position_dodge(width=.9), width=.5, colour="black")

How I could change colour of boxplots to single colour but get the boxes at the correct locations e.g. over violins.

Thanks
Petr



More information about the R-help mailing list