[R] Lattice: Feature Request

From: Jim Price <price_ja_at_hotmail.com>
Date: Thu, 10 Mar 2011 15:07:54 -0800 (PST)


Hi,

I'm currently designing some global themes for use with lattice, and have hit a snag. There doesn't appear to be (in xyplot at least) a way of setting a lattice option for the 'scales' parameter at a global level - changes have to be made in each function call. For example, consider the following code:

library(lattice)
library(latticeExtra)

# Create some data
temp <- expand.grid(

		    subject = paste('Subject', 1:2),
		    var = paste('Variable', 1:2),
		    time = 1:10)

temp$resp <- rnorm(nrow(temp))

# Example 1 - this is what I want to get to useOuterStrips(xyplot(

		      resp ~ time | subject * var,
		      data = temp,
		      as.table = TRUE,
		      between = list(x = 0.2, y = 0.2),
		      scales = list(alternating = 1, tck = c(1, 0), col = 'black')
		      ))

# Example 2 - set up theme for later use my.opts <- list(default.args = list(

		    		    as.table = TRUE,
				    between = list(x = 0.2, y = 0.2),
		    		    scales = list(alternating = 1, tck = c(1, 0), col = 'black') #
Illustrative, doesn't do anything
		))

dev.new()
useOuterStrips(xyplot(

		      resp ~ time | subject * var,
		      data = temp,
		      lattice.options = my.opts	# Note that the scales don't propagate
		      ))


As you can see the as.table and between parameters filter down nicely, but the scales don't. This looks like this is intended by the current code - the defaults in xyplot.formula for both scales and default.scales are empty lists - so I don't know if this is: intended for some technical reason that's just not obvious to me; an oversight on my part and there's some other way of doing this; or a feature that could be added.

Of course, I could also take this as a chance to learn how to submit patches, but thought I'd check to see if I'm missing anything first.

Technical stuff (because I'm not completely up to date):

> sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United
States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] latticeExtra_0.6-14 RColorBrewer_1.0-2 lattice_0.19-13

loaded via a namespace (and not attached):
[1] grid_2.12.0

Jim Price.
Cardiome Pharma. Corp.

--
View this message in context: http://r.789695.n4.nabble.com/Lattice-Feature-Request-tp3347040p3347040.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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 Mar 2011 - 03:37: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 Fri 11 Mar 2011 - 19:50:20 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