[R] help combining mtext and strwrap?

Jake Michaelson jjmichael at cc.usu.edu
Tue Nov 29 12:30:58 CET 2005


Hi all,

I've got some image plots on which I'd like to include some gene information 
(in the margins using mtext).  Unfortunately, the description is rather long 
and will need to be wrapped to fit on several lines.  From what I know about 
mtext, it's really only meant for single-line labels, not paragraphs.

Here's some sample code of the idea I'm trying to accomplish:

notes=c("Repressible alkaline phosphatase, a glycoprotein localized to the 
vacuole; regulated by levels of inorganic phosphate and by a system 
consisting of Pho4p, Pho9p, Pho80p, Pho81p and Pho85p; dephosphorylates 
phosphotyrosyl peptides")

par(mar=c(10,3,10,3))

image(as.matrix(c(1,2,3,4,5)))

mtext(strwrap(notes, width=60), line=5, side=3)


..as you can see, the long text plots over itself and doesn't wrap.  Does 
anyone know how to include a paragraph in the margins?

Thanks in advance!

--Jake




More information about the R-help mailing list