s-news
[Top] [All Lists]

Re: Multiple graphs

To: "Monti, Gustavo" <Gustavo.Monti@wur.nl>
Subject: Re: Multiple graphs
From: Sundar Dorai-Raj <sundar.dorai-raj@pdf.com>
Date: Wed, 16 Apr 2003 07:27:58 -0500
Cc: s-news@lists.biostat.wustl.edu
Organization: PDF Solutions, Inc.
References: <7D030487F1A3D143A76F2A1E91F570351676AD@scomp0010>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01


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


<Prev in Thread] Current Thread [Next in Thread>
  • Multiple graphs, Monti, Gustavo
    • Re: Multiple graphs, Sundar Dorai-Raj <=