ggplot2 - R ggplot - adding all data points to all facets -
until can't find appropriate answer, here short question ggplot2 in r:
data(mtcars) ggplot(data=mtcars, aes(x=mpg, y=wt, fill=factor(cyl))) + scale_fill_manual(values=c("red","orange","blue"))+ geom_point(size=2, pch=21)+ facet_grid(.~cyl) this fine, want data points (regardless number cyl has) in every facet (e.g. smooth grey below points)?
thanks, michael
using link given @beetroot, able :
g1 <- ggplot(data=mtcars, aes(x=mpg, y=wt)) + geom_point(data=mtcars[, c("mpg", "wt")], aes(x=mpg, y=wt), colour="grey") + geom_point(size=2, pch=21, aes(fill=factor(cyl))) + scale_fill_manual(values=c("red","orange","blue")) + facet_wrap(~cyl) hope helps you.


Comments
Post a Comment