[R] Computing line= for mtext

Frank Harrell f.harrell at vanderbilt.edu
Wed Feb 29 14:48:36 CET 2012


I want to right-justify a vector of numbers in the right margin of a
low-level plot.  For this I need to compute the line parameter to give to
mtext.  Is this the correct scalable calculation?

par(mar=c(4,3,1,5)); plot(1:20)
s <- 'abcde'; w=strwidth(s, units='inches')/par('cin')[1]
mtext(s, side=4, las=1, at=5, adj=1, line=w-.5, cex=1)
mtext(s, side=4, las=1, at=7, adj=1, line=2*(w-.5), cex=2)
 
Thanks
Frank

-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: http://r.789695.n4.nabble.com/Computing-line-for-mtext-tp4431554p4431554.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list