Reputation: 1
I am trying to visualize gene ontology data from David. I was able to create a bar plot and have arranged my data in descending order. I would like to organize this further based on its Category/fill color (to maintain same descending order per category). Any pointers will be helpful. PFA my R script below and the image that I have so far.
library(readr)
#import read CSV file
HDvC <- read_csv("G0_all_HDvscontrol.csv")
head(HDvC)
library(ggplot2)
myplot1 <- ggplot(HDvC, aes(x = reorder(Description, neglogFDR),
y = neglogFDR, fill = Category)) +
geom_bar(stat = "identity", position = "dodge") +
coord_flip() + labs(y = "-log (q value)",
x = "GO Description",
title = "HD vs Control") + theme_gray()
theme(plot.title = element_text(
hjust = 0.5, # center
size = 12,
color = "gray0",
face = "bold" )
)
myplot1
Upvotes: 0
Views: 381