I am wondering if anyone else had experienced the same problem as I can't find any post about it and don't know how to resolve it.
I am plotting 8 graphs and wanted to create a plot grid using ggarrange with the same legend.
Below is my code:
#gg3 is the data frame containing all my data. I created a for loop for all my plots
splot <- list()
for(i in 1:8){
splot[[i]] <- ggplot(gg3, aes(x=D50, y=gg3[ ,i],colour=group)) +
geom_point(aes(shape=group, color=group)) +
scale_shape_manual(values=c(16, 16),labels=c(paste("\u03B1"),paste("\u03B2"))) +
scale_color_manual(values=c("firebrick1","dodgerblue1"),labels=c(paste("\u03B1"),paste("\u03B2"))) +
theme_classic()+
geom_smooth(method=lm, se=F)+ labs(y=colnames(gg3)[i])
}
ggarrange(plotlist = splot,common.legend = T)
below is the ggarrange result. I managed to combine all of them, and each graph has different y-axis label (so they must have been different graphs) but the actual graphs are identical in the ggarrange object. I've checked my dataframe (gg3) and the values are all different.
Is this a bug in ggarrange?
p/s: I've tried grid.arrange too and same results
Thank you