Reputation: 3710
My code:
x <- c(10, 50, 20, 40)
barplot(x, names.arg=LETTERS[1:4])
What I want is:
I made this figure with the help of R and Adobe Acrobat. I am wondering can I obtain this figure using pure R code?
Upvotes: 3
Views: 1182
Reputation: 3710
Thanks to Pascal. I got another answer.
x <- c(10, 50, 20, 40)
barplot(x, names.arg=LETTERS[1:4])
mtext("E", side = 1, line = 3, adj = 0.375)
mtext("F", side = 1, line = 3, adj = 0.875)
axis(1, at=c(0.5,1,2,3,3.3), line=2.5, tick=T, labels=rep("",5), lwd=2, lwd.ticks=0)
axis(1, at=4+c(0.1,0.2,0.3,0.4,0.5),line=2.5,tick=T,labels=rep("",5), lwd=2, lwd.ticks=0)
Upvotes: 1
Reputation: 908
You can add text with mtext
mtext("E", side = 1, line = 3, adj = 0.375)
mtext("F", side = 1, line = 3, adj = 0.875)
and then draw line with lines
but indicating xpd=T
lines(c(0,3.5),c(-10,-10),xpd=TRUE)
lines(c(3.8,4.8),c(-10,-10),xpd=TRUE)
However, you need manually adjust it.
Upvotes: 2