[R] Unable to send color palette through plot.Design to method="image"
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Sun Aug 31 16:31:29 CEST 2008
David Winsemius wrote:
>
> 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:
I improved the source code to make use of col for 3-d plot types of
image, contour, and persp. I don't know why your hack didn't work. The
new changes work for me, and the updates will be in the next release of
Design to CRAN. I will e-mail you a copy of the source code to use in
the meantime.
Frank
> # 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
>
> ______________________________________________
> 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.
>
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list