[R] How to add the variable name to a qqplot or densityplot in the diagonal of an splom?
Michael Kubovy
kubovy at virginia.edu
Fri Feb 9 23:26:16 CET 2007
splom() doesn't complain here, but writes no names in the diagonal
boxes. What am I missing?
I believe that I need to add something like grid.text(x, ...) to the
diagonal panel, but I don't know how to get it cycle through the
column labels. And should
varname.col = 'blue', varname.cex = 1
be inside the diag.panel() function?
splom(szw[, n], pscales = 0,
diag.panel = function(x, ...){
panel.qqmathline(x, ...)
panel.qqmath(x, ...)
},
lower.panel = function(x, y, ...){
panel.xyplot(x, y, ..., col = 'lightblue')
panel.loess(x, y, ..., col = 'red')
},
upper.panel = function(x, y, ...){
panel.abline(lm(y~x),...)
grid.text(round(cor(x, y, use = 'pairwise.complete.obs'), 2),
x = unit(1, 'mm'),
y = unit(1, 'npc') - unit(1, 'mm'),
just = c('left', 'top'),
gp = gpar(fontsize = 10))
},
varname.col = 'blue', varname.cex = 1
)
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
More information about the R-help
mailing list