Dear R Users, I am quite surprised to see that mtext gives different results when it is used with 'pairs' and with "plot'. In the two following codes, it seems that the 'at' argument in mtext doesn't consider the same unit system.
I would appreciate your comments on this issue. Sebastien ##### Pairs mydata<-data.frame(x=1:10,y=1:10) par(cex.main=1, cex.axis=1, cex.lab=1, lwd=1, mar=c(5 + 5,4,4,2)+0.1) pairs(mydata,oma=c(5 + 5,4,4,2)) mylegend<-c("mylegend A","mylegend B","mylegend C","mylegend test") mylegend.width = strwidth(mylegend[which.max(nchar(mylegend))], "figure") for (i in 1:4) { mtext(text=mylegend[i], side = 1, line = 3+i, at = unit((1-mylegend.width)/2,"npc"), # centers the legend at the bottom adj=0, padj=0)} ##### plot mydata<-data.frame(x=1:10,y=1:10) par(cex.main=1, cex.axis=1, cex.lab=1, lwd=1, mar=c(5 + 5,4,4,2)+0.1) plot(mydata,oma=c(5 + 5,4,4,2)) mylegend<-c("mylegend A","mylegend B","mylegend C","mylegend test") mylegend.width = strwidth(mylegend[which.max(nchar(mylegend))], "figure") for (i in 1:4) { mtext(text=mylegend[i], side = 1, line = 3+i, at = unit((1-mylegend.width)/2,"npc"), # should center the legend at the bottom but doesn't do it ! adj=0, padj=0)} ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.