[R] long margin text below lattice plot - how to wrap lines?

knallgrau at gmx.com knallgrau at gmx.com
Wed Dec 12 08:22:20 CET 2012


Hello,

I've got a lattice plot and need to add text into the bottom margin of the plotting area (below the bottom legend). 
This seems to work in principle using grid.arrange, yet the text to be added is rather long. As a consequence, it gets clipped:

require(lattice)
require(grid)
myplot <- xyplot(1~1)
mytext <- textGrob("This is such a very very long text that it goes on forever and therefore needs to be wrapped in order for someone to be able to read it properly.")
grid.arrange(myplot, sub=mytext)

Is there any way to wrap the lines of the text or some other of workaround to this problem?

I've tried figuring it out myself, but it's a rather urgent problem and therefore I was hoping to find some help here.

Best,
Irene



More information about the R-help mailing list