Thank you for the advice. My data is like this: (Term)/(Count)/(PValue)/(Genes) /(List _Total)/(Pop_Hits)/(Pop_Total)/(Fold_Enrichment)/ (Bonferroni)/(Benjamini)/(FDR)/( Group)
it is a csv file and contains the above columns (I listed the columns and separate them by using / ). My original code is:
mydata_2 <- subset(mydata, mydata$PValue < 0.01) #select based on Pvale<0.01
mydata_3 <- mydata_2 %>% mutate(Term = fct_reorder(Term, logPValue)) #reorder the Term based on logPValue
#mydata_4 <- mydata_2 %>% mutate(Term = fct_reorder(Term, desc(logPValue))) #reorder it in the other way
p <- ggplot(data=mydata_3, aes(x=Term, y=logPValue), size =1) + geom_bar(position = 'dodge', stat='identity', fill = "red") +geom_text(aes(x = Term, y = logPValue,label=Count), hjust = -0.5, size = 3, inherit.aes = TRUE)
p
p+coord_flip() +theme_bw() +theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))
I added a group column in mydata_3 and label each row that belong to group 1 (contains first 20 rows), or group2(contains 21 rows). I want to put the geneontology and P value side by side separated by group factor. But do not know how to modify my code