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