[R] mtext in barplot

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Apr 5 17:43:39 CEST 2009



johnhj wrote:
> Hii,
> 
> Can anybody help me to put a text under the barplots. I will describe the
> percental between six grouped barplots. I tried to do it with mtext but
> without success.
> 
> Here is my code:
> 
> test <-read.table(file="D:/mobile.txt")
> 
> pdf(file = "D:/mobil126.pdf",
>     width = 6.67, height = 5, onefile = TRUE, family = "Helvetica",
>     title = "R Graphics Output", fonts = NULL, version = "1.1",
>       bg="white", pointsize=10)
> 
> barplot(as.matrix(test), main="OLSR",xlab="Hops",
> col=c("skyblue1","salmon"),width<-
> c(1,1),names=c("2->1","4->2","3->1","2->1","2->1","1->2"),  legend =
> rownames(x), beside=TRUE)
> 
> legend("topright", c("OLSR"),cex=0.8,ncol =1.5,col =
> c("red"),bg=c("lightskyblue1"))
> 
> dev.off()
> 
> 
> I tired to do it with 
> mtext(side=1,at=x, text =c("Mean", "","","","","rere"), col = "red"),
> line = 1, cex = 0.75) but without success, I get this example from a R
> tutorial...


What is x? The bars in a barplot are at locations 1:n.

Uwe Ligges


> Can anybody help me please ?
> 
> greetings,
> johnh




More information about the R-help mailing list