added annotation to the plot with annotate, still testing

This commit is contained in:
Tanushree Tunstall 2020-10-31 19:30:12 +00:00
parent 558f57c61e
commit 9c67a208e2

View file

@ -33,6 +33,7 @@ p2 = ggplot(single)+ geom_boxplot(aes(x = timepoint
))+
scale_colour_manual(values=c("blue", "red")) +
theme(axis.text.x = element_text(size = 15)
#axis.text.x = element_blank()
, axis.text.y = element_text(size = 15
, angle = 0
, hjust = 1
@ -60,11 +61,31 @@ p2 = p2 + stat_pvalue_manual(stat_npa2
, label = "{p} {p.signif}"
, hide.ns=T
, tip.length = 0)+
scale_y_continuous(expand = expansion(mult = c(0.05, 0.25)))
scale_y_continuous(expand = expansion(mult = c(0.05, 0.25))) +
scale_x_discrete()
plots[[i]] <- p2
}
cowplot::plot_grid(plotlist=plots, align = 'hv', ncol=2, nrow=2)
#cowplot::plot_grid(plotlist=plots, align = 'hv', ncol=2, nrow=2)
pdf("test2.pdf", width = 22, height = 16)
npa_plot<- ggpubr::ggarrange(plotlist = plots, align = "hv"
, ncol = 7
, nrow = 5
, common.legend = T)
npa_plot
annotate_figure(npa_plot,
top = text_grob("NPA", color = "purple", face = "bold", size = 14),
bottom = text_grob("Mosaic data\nFlu positive adults (n=133)"
, color = "blue",
hjust = 1, x = 0.98, face = "italic", size = 10),
left = text_grob("Levels (pg/ml)", color = "black", rot = 90, size = 18),
#right = "I'm done, thanks :-)!",
#fig.lab = "Figure 1", fig.lab.face = "bold"
)
pdf("test.pdf", width = 22, height = 16)
cowplot::plot_grid(plotlist=plots, align = 'hv', ncol=7, nrow=5)
dev.off()