Monti, Gustavo wrote:
Dear S-list members:
I want to combine 6 graphs in one page and each graph is based in
6 different datasets as well. I tried 2 approaches : one using editable
graphics commands and second using multiple plot layout.
For the first; I follow manual instructions works fine. But when I want
to plot 6 graphs which each one is the combination of 2, it produces the
6 desired graphs but not in one page .
Here is what I did (I just pasted 2 graphs for saving space only!)
coxsnwe <- guiPlot('Line Scatter', DataSet='wei4', Columns='h, haz')
guiPlot('Linear fit', DataSetValues=data.frame(wei4$h, wei4$h),
GraphSheet=coxsnwe, Graph=1)
guiCreate('XAxisTitle', Name='1', Title= 'residual')
guiCreate('YAxisTitle', Name='1', Title= 'Estimated Cumulative rates')
guiModify("GraphSheet", AutoArrange = "One Across" )
coxsnwep <- guiPlot('Line Scatter', DataSet='exp4', Columns='h, haz')
guiPlot('Linear fit', DataSetValues=data.frame(exp4$h, exp4$h),
GraphSheet= coxsnwep), Graph=1)
guiCreate('XAxisTitle', Name='1', Title= 'residual')
guiCreate('YAxisTitle', Name='1', Title= 'Estimated Cumulative rates')
The second approach worked fine as well and it is relative quicker to
implement and I get the graph that I want but the problem here is that I
want a 45 degrees straight line from 0 (represented by abline) but none
line is produced with that slope but also changes between graphs.
par(oma=c(2,2,4,2), mfrow=c(2,3))
Exp <- plot(exp$h, exp$haz, xlab='residual', ylab='Estimated Cumulative
Hazard rates',type='l', ylim=c(0,3),xlim=c(0,5))
abline(lm(exp$h~ exp$h), lty=2, col=6)
mtext(outer=T, "Cox-Snell Residuals Plot", side=3, line= 2, cex=1.5)
title(main='Exponential')
wei <- plot(wei8b$h, wei8b$haz, xlab='residual', ylab='Estimated
Cumulative Hazard rates',type='l', ylim=c(0,3), xlim=c(0,5))
abline(lm(wei8b$h ~ wei8b$h), lty=2, col=6)
title(main='Weibull')
I used S-plus 2000 rel. 3 on windows.
Resuming, by one method I produce the graph I need but I can join all in
one page and in the other I join and produce graphs but I can't produce
the reference line I want.
I appreciate any help or suggestions in how to solve it.
To add a 45 degree line use
abline(a = 0, b = 1)
which plots the line y = a + b * x.
Sundar
|