I have a couple of scatterplots in R. all of them have x-axis and y-axis labels and titles as well. But when I merge them by subplot function their labels and titles disappear. How can I resolve it?
for (i in 1: length(s)) {
mat = matrix(ncol = 0, nrow = 0)
E = data.frame(mat)
E2 = P2[[i]]
E2 = as.data.frame(E2)
E1 = P1[[i]]
E1 = as.data.frame(E1)
E = cbind(E1, E2)
colnames(E) = c("group1", "group2")
w1 = group1_vectors[i]
w2 = group2_vectors[i]
w3 = gene_vectors[i]
plot1 = ggplot(E, aes(x = group1 , y = group2)) +
labs(title= w3,
x= w1, y = w2)+
geom_point()
plot_list_final[[i]] = plot1
}
plot_list_final = do.call(tagList, plot_list_final)
f = length(s)
p_last <- subplot(plot_list_final[1:f], nrows = f, margin = 0.045) %>%
layout(title = "Plots of selected rows (Genes)")
dev.off()
return(p_last)