Dear all,
I am trying to use function from clusterProfiler and DOSE packages and made a conditional loop for plotting. It seems it does not work properly (plot only last one), why I really dont figure it out. Please help.
ont="DO"
## this does not work ?? plot only enrichMap, why?
if (ont=="DO") {
pdf("DO.plots1.pdf",width=11,height=8.5)
barplot(enrich_go_do, drop=T, showCategory = 30, title = "Disease Ontology")
# altrneative of barplot
dotplot(enrich_go_do, x = "geneRatio", colorBy = "p.adjust", showCategory = 10, title = "Disease Ontology (Category 10)")
enrichMap(enrich_go_do,n = 10) # topten
dev.off()
}
## this works perfectly
pdf("DO.plots2.pdf",width=11,height=8.5)
# # Disease Ontology plots
barplot(enrich_go_do, drop=T, showCategory = 30, title = "Disease Ontology")
# altrneative of barplot
dotplot(enrich_go_do, x = "geneRatio", colorBy = "p.adjust", showCategory = 10, title = "Disease Ontology (Category 10)")
enrichMap(enrich_go_do,n = 10) # topten
dev.off()
What do you mean by "plot only last one"? Does it produce only one graph for the whole for-loop? Or that without if it plots?
yes its processed only one plot out of 3 plot given.
Thank you guys..problem solved.
it was needed
print(barplot())
. The reason was author has made barplot function using ggplot2.I stuck on this problem for several hours. Yes.
print(barplot())
andprint(dotplot())
work fine.