I am plotting three plots next to each other using facet_grid.
Facet grid will only draw the y-axis for the first plot. Is there a way to draw the y-axis for all three plots?
here's a reproducible example:
require(ggplot2)
require(reshape)
require(grid)
a<-rnorm(100)
b<-runif(100)
c<-rpois(100,lambda=2)
abc<-cbind(a,b,c)
colnames(abc)<-c("a","b","c")
abc<-melt(abc,id.vars=1:1)
colnames(abc)<-c("c","variable","value")
d<-rep(c("a","b","c"),each=100)
abc<-cbind(d,abc)
colnames(abc)<-c("cond","c","variable","value")
plot1<-ggplot(abc,aes(x=c,y=value,colour=variable,size=variable))+geom_point()+theme(legend.position="right")+facet_grid(~cond)+theme_bw()+theme(axis.text=element_text(size=8),
axis.title=element_text(size=8),
text = element_text(size=14),
axis.line = element_line(size=0.25),
axis.ticks=element_line(size=0.25),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_blank(),
legend.position="none" ,
legend.direction="vertical",
legend.title=element_blank(),
legend.text=element_text(size=8),
plot.margin=unit(c(0,0.3,0,0),"cm"),
legend.background=element_blank(),
legend.key=element_blank())
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…