New to R and still in the process of learning. Now, I am trying to plot GO in ggplot2 and need to separate the terms based on their category, so i tried the script below:
data <- read.csv("GO_Up.csv", sep =",", header = TRUE, stringsAsFactors = FALSE)
names(data) <- c("category", "ID", "term”, “count","pvalue")
names(data) <- c("category", "ID", "term", "count","pvalue")
S1<- ggplot(data, aes(x= count, y= reorder(term,- pvalue), size=count, color=p_value, group=count)) + geom_point(alpha = 0.8) + facet_wrap (~category)
S1 = S1+scale_color_gradient(low="red2", high="mediumblue", space="Lab",limit =c(0,0.1))
S1+theme(axis.text.x=element_text(family = "Tahoma+", size=8))
got a plot as below:
x-special/nautilus-clipboard
copy
file:///home/vrinda/Downloads/GO%20jumbled%20Yaxis.png.png
what I need is to have the terms based on the category on the y axis, but instead all the terms show up.
I need something that may look like the image below:
x-special/nautilus-clipboard
copy
file:///home/vrinda/Downloads/1642673545.39.png
How may I sort this in the script I have?
Need help urgently.
Thank you