Hi all,

I'm trying to change the pch, color, lty, and lwd in a type="p" plot
produced by plot.Predict in the rms package.  What I'm shooting for is a
separate plotting symbol symbol color for each level of a factor (and also
to manage the line width for the CIs).

Here's what I hope is a working example

#make up some data
n     = 30
x1   = runif(n)
group = factor(rep(1:3, length.out=n))
e     = rnorm(n, 0, 1)

#population model
y     = as.numeric(group) + 0.2*x1 + e

#make a dataframe
population.df <- data.frame(x1,group,y)
#clean up
rm(n,x1,group,e,y)

#load rms package
require(rms)

#store predictor characteristics
d<-datadist(population.df)
options(datadist="d")

# model.
f1 <- ols(y ~ x1+group, population.df)
#model result
summary(f1)

#get predicted values
pf1<-Predict(f1,group)

#plot
myplot<-plot(pf1,~group,nlines=T,type='p',
ylab='fitted Y',
xlab='Treatment')

#print plot with defaults
myplot

#try to alter settings
plot.symbol.settings<-trellis.par.get("plot.symbol")
#have a look at settings
str(plot.symbol.settings)


plot.symbol.settings$pch<-c(1,2,3)
plot.symbol.settings$col<-c(2,1,3)
plot.symbol.settings$lwd<-3
plot.symbol.settings$cex<-1.5

trellis.par.set("plot.symbol", plot.symbol.settings)

#print again with new settings
myplot

As you can see, only the first pch and color are passed.  So, obviously I
am missing something important.

Also, I notice that the lwd argument has no effect, so I am assuming this
is controlled by something else, but I haven't found it yet.

I'd be grateful if somebody could point me in the right direction.

Thanks,

Mike Babyak
Department of Psychiatry and Behavioral Sciences
Duke University Medical Center
R version 3.01  Windows 7

	[[alternative HTML version deleted]]

