Dr Stuart Reece
2009-Apr-09 02:10 UTC
[R] Multiple Hexbinplots in 2 columns with a Single Categorical Variable
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)))), par.strip.text = list(cex = 1))) [[alternative HTML version deleted]]
Stuart Reece
2009-Apr-09 11:18 UTC
[R] Multiple Hexbinplots in 2 columns with a Single Categorical Variable
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)))), par.strip.text = list(cex = 1))) [[alternative HTML version deleted]]
Paul Murrell
2009-Apr-10 00:07 UTC
[R] Multiple Hexbinplots in 2 columns with a Single Categorical Variable
Hi Does this do it ... ? 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=c(1, 0)), layout.widths=list(axis.panel=c(1, 0)), par.strip.text=list(cex=1)))) In this example, the 'relation="free"' is not doing much, so a simpler version would be just ... useOuterStrips(hexbinplot(Transferin ~ Age | factor(Race) + factor(Sex), data = NHANES, type = "r", aspect = 1, scales = list(alternating=1, tck=c(1, 0)))) ... but it sounds like that might not be appropriate for your real problem. Paul Dr Stuart Reece 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)))), > par.strip.text = list(cex = 1))) > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Deepayan Sarkar
2009-Apr-20 21:40 UTC
[R] Multiple Hexbinplots in 2 columns with a Single Categorical Variable
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