[R] textbox in lattice

baptiste auguie baptiste.auguie at googlemail.com
Tue Jun 1 21:07:10 CEST 2010


Please do read the posting guide, in particular regarding reproducible examples.

You can use a Grid layout to place the lattice plot and a table in the
same page. For example,

library(lattice)
 library(coda)
 library(gridExtra)
   x <- matrix(runif(2200),ncol=22)
   m <- as.mcmc(x)
  p = xyplot(m, layout = c(2, 11))

 pdf(,height=15)
 arrange(p, tableGrob(as.matrix(summary(iris)), theme=theme.white()),
heights= unit(c(3,1),"null"))
 dev.off()

HTH,

baptiste
On 1 June 2010 20:52, Noah Silverman <noah at smartmediacorp.com> wrote:
> Hi,
>
> It is a matrix.  Exactly the output of summary(foo)
>
> Would you call the gridExtra command before the xyplot command or after?
>
> Now I have:
>
> temp <- as.mcmc(foo)
> xyplot(temp, layout=c(2,11), main="plot title")
>
>
> THANKS!!
>
>
> On 6/1/10 11:35 AM, baptiste auguie wrote:
>> Hi,
>>
>> It's not clear what you mean by summary text without a minimal
>> reproducible example. If your text is ordered as a matrix or a
>> data.frame, you might want to try this grid function,
>>
>> gridExtra::grid.table(as.matrix(summary(iris)), theme=theme.white())
>>
>> If your text has the form of a paragraph, the RGraphics::splitTextGrob
>> function might help.
>>
>> HTH,
>>
>> baptiste
>>
>>
>>
>> On 1 June 2010 19:37, Noah Silverman <noah at smartmediacorp.com> wrote:
>>
>>> Hi,
>>>
>>> I want to add a box at the bottom of a lattice window (device/page?).
>>>
>>> Lattice has drawn a nice group of panels with all the plots I need.  How
>>> do I add my own summary text at the bottom (several lines worth?)
>>>
>>> ______________________________________________
>>> 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.
>>>
>>>



More information about the R-help mailing list