Entering edit mode
3.0 years ago
Trinh
•
0
Hi, I have 2 dot plots with the same code. However, sometimes p-value bars change position automatically.
Please help me, how to anchor it? Thank you very much!
#Dotplot
##########GO analysis done with the GO analysis tool at the CGD (default settings)###############
GO <- readxl::read_excel("Cluster1_GO_CGD.xlsx", sheet = "plotting")
GO
#Upregulation
go1 <- filter(GO, Sample == "MouseUp", Pval_adjust <= 0.05)
p1 <- ggplot(go1[-c(4,5),], aes(x=reorder(GO, -Pval_adjust), y=Input_ratio)) +
geom_point(aes(size=hits, col=Pval_adjust)) +
scale_size_continuous(name = "No. of Prots", range = c(3,6)) +
coord_flip() + scale_color_distiller(name = "Adj. p-value", palette = "OrRd") + xlab("") + ylab("Input ratio")
p1 +
theme(axis.title.y = element_text(face = "plain", size = 18, color = "black", margin = margin(0,0.3,0,0,"cm"))) +
theme(axis.title.x = element_text(face = "plain", size = 15, color = "black", margin = margin(0.3,0,0,0,"cm"))) +
theme(axis.text.x = element_text(face = "plain", size = 12, color = "black", angle = 25, vjust = 0.2, hjust = 0.2)) +
theme(axis.text.y = element_text(face = "plain", size = 25, color = "black", angle = 0, margin = margin(0,0.1,0,0,"cm")))
#Downregulation
go2 <- filter(GO, Sample == "MouseDown", Pval_adjust <= 0.05)
p2 <- ggplot(go2[-c(4,5),], aes(x=reorder(GO, -Pval_adjust), y=Input_ratio)) +
geom_point(aes(size=hits, col=Pval_adjust)) +
scale_size_continuous(name = "No. of Prots", range = c(3,6)) +
coord_flip() +
scale_color_distiller(name = "Adj. p-value", palette = "PuBu") + xlab("") + ylab("Input ratio")
p2 +
theme(axis.title.y = element_text(face = "plain", size = 18, color = "black", margin = margin(0,0.3,0,0,"cm"))) +
theme(axis.title.x = element_text(face = "plain", size = 15, color = "black", margin = margin(0.3,0,0,0,"cm"))) +
theme(axis.text.x = element_text(face = "plain", size = 12, color = "black", angle = 25, vjust = 0.2, hjust = 0.2)) +
theme(axis.text.y = element_text(face = "plain", size = 20, color = "black", angle = 0, margin = margin(0,0.1,0,0,"cm")))
library(gridExtra)
cowplot::plot_grid(p1, p2, ncol = 2, labels = c("A", "B"))