s-news
[Top] [All Lists]

Re: plot area

To: <bcutayar@lfdj.com>, "'S-news community'" <s-news@lists.biostat.wustl.edu>
Subject: Re: plot area
From: rpugh <rpugh@mango-solutions.com>
Date: Thu, 31 Jul 2003 15:26:02 +0100
Importance: Normal
In-reply-to: <200307311355.PAA04691@athos.lfdj.com>
Organization: Mango Solutions
Reply-to: <Rpugh@mango-solutions.com>

Hi Bruno,

 

A bit basic, but it works (accepting any number of “y” variables) …

 

myDf <- data.frame(x=1:10, y=rnorm(10), z=rnorm(10, 3))

 

areaPlot <- function(xVar, ..., sort=T) {

   yVars <- as.character(match.call()[-(1:2)])

   myMat <- cbind(...)

   plot(xVar, 1:length(xVar), type="n", ylim=range(myMat), ylab=paste(yVars, collapse=" / "))

   for (i in 1:ncol(myMat)) {

       polygon(c(xVar[1], xVar, xVar[length(xVar)]), c(min(myMat), myMat[,i], min(myMat)), col=i)

   }

   invisible()

}

 

areaPlot(myDf$x, myDf$z, myDf$y)

 

Hope this is useful …

Rich.

 

Mango Solutions

Tel : (01628) 418134

Mob : (07967) 808091

 

-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Bruno Cutayar
Sent: 31 July 2003 14:56
To: S-news community
Subject: [S] plot area

 

Hi all,
does someone know an equivalent for the guiPlot function :
guiPlot ( PlotType = "Area", DataSet = "data", Columns = "var1,var2,var3", GraphSheet = "GSD1", AxisType = "Linear") ?

i would like using regular plot function instead.

thank you,
Bruno


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.483 / Virus Database: 279 - Release Date: 19/05/2003

<Prev in Thread] Current Thread [Next in Thread>