On 1/22/08, Judith Flores <[EMAIL PROTECTED]> wrote:
> Hi,
>
>    Is there an analog function of textplot in the
> lattice package? I need to add a data frame to a
> lattice plot. I work in a Windows environment and I am
> using R v 2.6.1

There's nothing built-in, but if you are happy with fixed width text,
a simple wrapper to capture.output() should be good enough. Here's one
approach:

panel.textplot <-
    function(object, ...,
             gp = gpar(fontfamily = "mono"))
{
    require(grid)
    foo <- capture.output(object)
    grid.text(paste(foo, collapse = "\n"), ..., gp = gp)
}


xyplot(1 ~ 1,
       panel = function(...) {
           panel.xyplot(...)
           panel.textplot(head(iris))
       })

You could use other arguments to grid.text() in the call to
panel.textplot(), giving a fair amount of control over placement etc.

-Deepayan

______________________________________________
R-help@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.

Reply via email to