Entering edit mode
5.5 years ago
saamar.rajput
▴
80
I am making bar plots using ggplot for the GO enrichment analysis I did. Now I have upregulated Go terms and downregulated GO terms. My data looks like this:
head(Up)
GO Percentage q.val
1 extracellular region 4.959008 2.154712e-10
2 extracellular region part 2.899420 6.910822e-09
3 extracellular space 2.279544 6.910822e-09
4 immune response 4.109178 4.010631e-08
5 response to wounding 3.779244 5.724871e-08
head(Down)
GO Percentage q.val
1 extracellular region 0.000000 NA
2 extracellular region part 0.000000 NA
3 extracellular space 0.000000 NA
4 immune response 0.019996 NA
5 response to wounding 6.596415 3.109178e-05
Currently I am making two plot
U <- ggplot(data = Up, aes(x = GO, y = Percentage)) +
geom_bar(stat = "identity", aes(fill =-10*log10(q.val)) +
labs(fill = "Positive log10 FDR")+
theme(plot.margin = margin(6,.5,1,.5, "cm"), axis.text.x = element_text(
angle = 90,
hjust = 1,
vjust = 0.5,
size=13
), axis.text.y = element_text(
size=12
))
D <- ggplot(data = Down, aes(x = GO, y = Percentage)) +
geom_bar(stat = "identity", aes(fill =-10*log10(q.val))) +
labs(fill = "Positive log10 FDR")+
theme(plot.margin = margin(6,.5,1,.5, "cm"), axis.text.x = element_text(
angle = 90,
hjust = 1,
vjust = 0.5,
size=13
), axis.text.y = element_text(
size=12
))
After generating the plots in R, i am using inkscape to overlay the two plots into one. Is there an efficient way in R to do so?
https://stackoverflow.com/questions/40297206/overlaying-two-plots-using-ggplot2-in-r?rq=1
This brings both the plot in one picture, but I want the Go terms to appear once and upregulated bar plots at one side and downregulated bar plot on the other side. This means the GO terms would be once in the middle.
Combine the data frames? Your plotting logic is identical so combining the datasets being plotted should plot them appropriately.
Also, please show us what your plots look like right now and how you'd like them to look. See this post on how to upload images.