PIKAL Petr <petr.pikal <at> precheza.cz> writes:

> 
> 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))

 [snip]
> 
> How I could change colour of boxplots to single colour 
> but get the boxes at the correct locations e.g. over violins.
> 
> Thanks
> Petr
> 
> 

Use the group() aesthetic:

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

By the way, it would be useful to remind us that Cars93 is available in
the MASS package -- I had to hunt around a little bit.

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to