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
long margin text below lattice plot - how to wrap lines?
2 messages · knallgrau at gmx.com, Pascal Oettli
Hello
You can insert \n in your text.
mytext <- textGrob("This is such a very very long text\n that it goes on
forever and therefore needs to be wrapped in order\n for someone to be
able to read it properly.")
HTH
Pascal
Le 12/12/2012 16:22, knallgrau at gmx.com a ?crit :
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
______________________________________________ R-help at r-project.org 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.