Taylor, Sean D
2013-Aug-06 16:09 UTC
[R] lattice yscale.components: use multiple convenience functions
Good morning, I really enjoy some of the recent convenience functions in lattice_0.20-15 and latticeExtra_0.6-24. I am wondering if there is a way to use multiple functions in the same call? Specifically, I would like to be able to use yscale.components.log10ticks (to get the major tick marks at powers of 10 and minor tick marks in between) and also label the major tick marks smartly using superscripts for the power. Something along the lines of this: ##Pseudocode, does not work xyplot((1:200)/20 ~ (1:200)/20, type = c("p", "g"), scales = list(x = list(log = 2), y = list(log = 10)), xscale.components = xscale.components.fractions, yscale.components = list(yscale.components.log10ticks, yscale.components.logpower)) or this: ##Does not work xyplot((1:200)/20 ~ (1:200)/20, type = c("p", "g"), scales = list(x = list(log = 2), y = list(log = 10)), xscale.components = xscale.components.fractions, yscale.components = function(...){ yscale.components.log10ticks yscale.components.logpower} ) Thanks! Sean Sean Taylor Post-doctoral Fellow Fred Hutchinson Cancer Research Center 206-667-5544 [[alternative HTML version deleted]]
David Winsemius
2013-Aug-06 17:54 UTC
[R] lattice yscale.components: use multiple convenience functions
On Aug 6, 2013, at 9:09 AM, Taylor, Sean D wrote:> Good morning, > > I really enjoy some of the recent convenience functions in lattice_0.20-15 and latticeExtra_0.6-24. I am wondering if there is a way to use multiple functions in the same call? Specifically, I would like to be able to use yscale.components.log10ticks (to get the major tick marks at powers of 10 and minor tick marks in between) and also label the major tick marks smartly using superscripts for the power. Something along the lines of this:See the code supporting figures 8.4 and 8.5 in Sarkar's Lattice book. -- David.> > ##Pseudocode, does not work > xyplot((1:200)/20 ~ (1:200)/20, type = c("p", "g"), > scales = list(x = list(log = 2), y = list(log = 10)), > xscale.components = xscale.components.fractions, > yscale.components = list(yscale.components.log10ticks, > yscale.components.logpower)) > > or this: > ##Does not work > xyplot((1:200)/20 ~ (1:200)/20, type = c("p", "g"), > scales = list(x = list(log = 2), y = list(log = 10)), > xscale.components = xscale.components.fractions, > yscale.components = function(...){ > yscale.components.log10ticks > yscale.components.logpower} > ) > > Thanks! > Sean > > Sean Taylor > Post-doctoral Fellow > Fred Hutchinson Cancer Research Center > 206-667-5544 > > > [[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.David Winsemius Alameda, CA, USA