Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized.
Hello all I need one help in plot ggplot Suppose I have file containing 1 column the terms like biological processes,molecular function, cellular components 2 column has count of gene having particular function 3 column David ID GOxxxxxx 4 column function of set of gene for eg RNase activity etc I want to plot ggplot having X axis David I'd Y axis count But my geom_bar colour should be different for molecular function, cellular components, biological processes How should I proceed Please help
2 answers
require(clusterProfiler)
require(ggplot2)
data(geneList)
de = names(geneList)[1:100]
x=enrichGO(de, OrgDb='org.Hs.eg.db', ont='ALL')
ggplot(x, aes(ID, Count, fill=ONTOLOGY), split='ONTOLOGY') + geom_col() +
theme(axis.text.x=element_text(angle=-40, hjust=0)) + facet_grid(.~ONTOLOGY, scale="free_x")

Hi guangchuang yu Thanks for this !! I was searching for this few month ago same kind of plot but ended up with overlaping value in x-axis It would be appreciable if you help me so that i can apply the same for my future work Thanks
you can use clusterProfiler which use y axis for GO/pathway description to prevent overlapping text.
Log in to answer this question.
I want to plot bar using ggplot with different color for biological processes molecular function and cellular process
I guess you know nothing about ggplot2.
a bar plot (
geom_col(), which is a short cut ofgeom_bar(stat='identity')) that mapidtoxandcounttoyand useontologyto color the bars.go to read some docs before posting a question with no idea of what you (and someone else) are talking about.
Ok thanks for your suggestions and answer