[R] textbox in lattice

Noah Silverman noah at smartmediacorp.com
Tue Jun 1 21:12:07 CEST 2010


That's amazing.  (It would have taken me many hours to figure this out
on my own.)

Two quick last questions and then I'm off to plotting:
1) How can I reduce the font size of the table. (It is huge on my plot.)
2) How can I control the ratio of "plot area" to "table area" in the grid?

Thanks a million!

-N


On 6/1/10 12:07 PM, baptiste auguie wrote:
> 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