Change the width of the bars in the barchart (R)

I am wondering how to change the width of the bars in the barchart () function.

Here is the code:

rater1 <- c(0.75, 0.66, 0.73, 0.63) barplot(rater1, ylim=c(0:1),axes = TRUE, names.arg = c("A", "B", "C", "D"), axisnames=TRUE, col="grey70") 

Is it also possible to place value labels above columns?

Thanks.

+4
source share
1 answer

From ?barplot :

space: the amount of space (as a fraction of the average width of the bar) to the left of each bar. It can be indicated as one number or one number per bar. [...]

So, for example, compare:

 tN <- table(Ni <- stats::rpois(100, lambda = 5)) barplot(tN, col = rainbow(20)) barplot(tN, col = rainbow(20), space=0) barplot(tN, col = rainbow(20), space=10) 
+8
source

All Articles