I've written a script that correctly overlays points on a dotchart as
follows:
MAIN <- "Overlay"
dotchart(x,labels=levels(y),
pch=PCH,xlim=c(min(all,na.rm=T),max(all,na.rm=T)),
main=MAIN,xlab="Growth of $1",cex=.4,
col.main="blue",col="blue",col.axis="blue",col.sub="blue",col.lab="blue",
sub=paste("Year to Date, ", as.date(slug[2]), " thru
",
as.date(slug[3]),sep=""))
legend("bottomleft", c("Growth", "Neutral","
Value"),col=c("red","blue","green"),
cex=.4,lwd=1)
x <- all[rgidx-1]
points(x,y=y,pch=PCH,col="red",cex=CEX)
x <- all[rvidx-1]
points(x,y=y,pch=PCH,col="green",cex=CEX)
I would now like to produce the same graph, but group the dotchart labels by
a size factor:
MAIN <- "Hybrid"
grp <- as.factor(c(rep(c('Small'),5),rep(c('Large'),4)))
dotchart(x,labels=levels(y),
pch=PCH,xlim=c(min(all,na.rm=T),max(all,na.rm=T)),
main=MAIN,xlab="Growth of $1",cex=.4,group=grp,
col.main="blue",col="blue",col.axis="blue",col.sub="blue",col.lab="blue",
sub=paste("Year to Date, ", as.date(slug[2]), " thru
",
as.date(slug[3]),sep=""))
legend("bottomleft", c("Growth", "Neutral","
Value"),col=c("red","blue","green"),
cex=.4,lwd=1)
x <- all[rgidx-1]
points(x,y=y,pch=PCH,col="red",cex=CEX,group=grp)
x <- all[rvidx-1]
points(x,y=y,pch=PCH,col="green",cex=CEX,group=grp)
The output here is not as desired. The initial dotchart prints properly, but
the subsequent points are off - as if the points function cannot determine
the grouping. If I change the grouping to the trivial: grp <-
as.factor(c(rep(c('Small'),9))), the chart works as expected. I am
obviously missing something simple. Any ideas?
Thanks.
Steve Miller
[[alternative HTML version deleted]]