Equal distance between groups in a barplot
2
0
Entering edit mode
4.5 years ago
c.chakraborty ▴ 170

I have a very simple question and I have been quite unable to find a suitable answer. I am making barplots for GO-enriched terms-

barplot(Fold.Enrichment,
names.arg = Description,
horiz = TRUE,
cex.names = 0.5,
cex.axis = 0.6,
col = "blue",
xlim = c(0, 3))


When I get the plot, not all the bars are equidistantly separated from each other. It looks clumsy. Is there a way by which, I can specify a distance between bars?

R • 1.5k views
2
Entering edit mode
4.5 years ago
firatuyulur ▴ 310

I just read now that there is a parameter called "space" in barplot function. for each bar, you type the distance from the next bar.

1
Entering edit mode
4.5 years ago
c.chakraborty ▴ 170

Problem solved:

barplot(david_go__ord_foldenr$Fold.Enrichment, names.arg = david_go__ord_foldenr$Description,
horiz = TRUE,
space = 0.1,
cex.names = 0.5,
cex.axis = 0.6,
col = "blue",
xlim = c(0,3))