[R] Unable to send color palette through plot.Design to method="image"

David Winsemius dwinsemius at comcast.net
Sat Aug 30 21:08:11 CEST 2008


I have been trying to specify a different color palette to the image  
method in plot.Design. My model has crossed two rcs() arguments and  
one two-level gender argument. The goal which appears to have been  
mostly achieved is to produce separate bivariate plots for men and women

The call to plot does produce a level plot but it appears only with  
the default color palette despite various efforts to supply a col  
argument. I even took a crack at hacking the plot.Design function,   
adding a col=col parameter to be passed in the function call to  
image(), but failed to get the desired effect:
  # else image(xseqn, y, zmat, xlab = xlab, ylab = laby , col = col)

library(Hmisc); library(Design)
lr.fit6 <- lrm(death ~  
rcs(BL_CHOLEST.A,c(180,220,280))*rcs(BL_HDL.A,c(40,55,70))*Sex, data =  
pref900)

# str(pref900[,c("BL_HDL.A","BL_CHOLEST.A","death")])
$'data.frame':	910659 obs. of  3 variables:
  $ BL_HDL.A    : num  34 35 40 46 39 45 46 34 42 52 ...
  $ BL_CHOLEST.A: num  181 184 238 134 180 220 125 256 265 175 ...
  $ death       : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...

plot(lr.fit6, BL_HDL.A=seq(25,125, length=50),BL_CHOLEST.A=seq(100,  
350, length=70), Sex="Male", col = rainbow(15), method="image")

Respectfully;
David Winsemius, MD, MPH
Heritage Laboratories,
West Hartford, CT, USA



More information about the R-help mailing list