Re: [R] Lattice: merged strips?

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Fri, 11 Jul 2008 16:52:44 -0700

On 7/10/08, Mike Lawrence <Mike.Lawrence_at_dal.ca> wrote:
> As I understand it, Duncan MacKay's solution involves simply pasting the
> factors together, as in:
>
> |_AX_|_AY_|_BX_|_BY_|
>
> Which isn't quite as aesthetically pleasing as what I I'm looking for:
>
> |___A___|___B___|
> |_X_|_Y_|_X_|_Y_|
>
> Any further suggestions?

There is no easy way, especially if you want a general solution, but for your specific example, here is a possible starting point:

dotplot(variety ~ yield | site * year, data = barley,

        subset = (site %in% c("Grand Rapids", "Duluth")),
        strip = function(which.given, which.panel,
                         var.name, factor.levels, ...) {
            str(list(which.given = which.given,
                     which.panel = which.panel,
                     var.name = var.name,
                     factor.levels = factor.levels, ...))
            if (which.given == 1)
                strip.default(which.given = which.given,
                              which.panel = which.panel,
                              var.name = var.name,
                              factor.levels = factor.levels, ...)
            else {
                panel.rect(0, 0.5, 1, 1, col = "#ccffcc",
                           border = "transparent")
                if (which.panel[1] == 2)
                    panel.text(0, 0.75,
                               labels = factor.levels[which.panel[2]])
            }
        })

-Deepayan



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. Received on Fri 11 Jul 2008 - 23:57:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 12 Jul 2008 - 04:31:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive