[R] Multiple Hexbinplots in 2 columns with a Single Categorical Variable
Deepayan Sarkar
deepayan.sarkar at gmail.com
Mon Apr 20 23:40:23 CEST 2009
On Thu, Apr 9, 2009 at 4:18 AM, Stuart Reece <sreece at bigpond.net.au> wrote:
> Dear Ladies and Gentlemen,
>
> I have a fairly large database (N=13,000) and a single main categorical discriminator between the groups.
>
> I want to look at the time course of a number of continuous biochemical variables over chronologic age.
>
> Therefore I believe I need to prepare hexbinplots in two columns with simple regression lines in them (with useOuterStrips (in library(latticeExtra) if possible) and also single hexbinplots with two regression lines (panel.lmlines) corresponding to the two groups to facilitate data comparison.
>
> Tick marks and labels should be off in most panels, and the scale in each row will be different.
>
> I have some code written for the NHANES dataset in library(hexbin) which almost does this job, but leaves blank paper up the middle of the two columns of panels.
>
> I have been exploring lattice for this which almost gets me there but not quite.
>
> The code I have written is as follows.
>
> I would be ever so grateful for any advice anyone may be able to offer.
>
> With best wishes,
>
> Stuart Reece,
>
> Australia.
>
>
>
>
>
> useOuterStrips(hexbinplot(Transferin ~ Age | factor(Race) + factor(Sex), data = NHANES, type = "r",
>
> aspect = 1,
>
> scales =
>
> list(x =
>
> list(relation = "free", rot = 0,
>
> at=list(TRUE, TRUE, NULL, NULL)),
>
> y =
>
> list(relation = "free", rot = 0,
>
> at=list(TRUE, NULL, TRUE, NULL))),
>
> par.settings = list(layout.heights = list(axis.panel = rep(c(1, 0),c(1, 1)))),
You need the same trick for the widths:
par.settings =
list(layout.heights = list(axis.panel =
rep(c(1, 0),c(1, 1))),
layout.widths = list(axis.panel =
rep(c(1, 0),c(1, 1)))),
> par.strip.text = list(cex = 1)))
-Deepayan
More information about the R-help
mailing list