Revision: 1048
http://svn.sourceforge.net/r-gregmisc/?rev=1048&view=rev
Author: warnes
Date: 2007-02-08 08:56:57 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
Add parameters to control line width and line type.
Modified Paths:
--------------
trunk/gplots/R/bandplot.R
Modified: trunk/gplots/R/bandplot.R
===================================================================
--- trunk/gplots/R/bandplot.R 2007-02-05 23:21:52 UTC (rev 1047)
+++ trunk/gplots/R/bandplot.R 2007-02-08 16:56:57 UTC (rev 1048)
@@ -6,18 +6,22 @@
sd=c(-2:2),
sd.col=c("lightblue","blue","red",
"blue","lightblue"),
+ sd.lwd=c(1,2,3,2,1),
+ sd.lty=c(2,1,1,1,2),
method="frac", width=1/5,
n=50
)
{
if(length(sd.col)<length(sd)) sd <-rep(sd.col,length=length(sd))
+ if(length(sd.lwd)<length(sd)) sd <-rep(sd.lwd,length=length(sd))
+ if(length(sd.lty)<length(sd)) sd <-rep(sd.lty,length=length(sd))
if(!add)
{
m <- match.call(expand.dots = TRUE)
m$width <- m$add <- m$sd <- m$sd.col <- NULL
- m$method <- m$n <- NULL
+ m$method <- m$n <- m$sd.lty <- m$sd.lwd <- NULL
m[[1]] <- as.name("plot")
mf <- eval(m, parent.frame())
}
@@ -31,16 +35,21 @@
else
mean(x)+sd*sqrt(var(x))
- sdplot <- function(S, COL)
+ sdplot <- function(S, COL, LWD, LTY)
{
where <- wapply(x,y,CL,sd=S,width=width,method=method,n=n)
- lines(where,col=COL,...)
+ lines(where,col=COL,lwd=LWD,lty=LTY,...)
where
}
stdevs <- list()
for( i in 1:length(sd) )
- stdevs[[as.character(sd[i])]] <- sdplot( sd[i], sd.col[i] )
+ stdevs[[as.character(sd[i])]] <- sdplot(
+ sd[i],
+ COL=sd.col[i],
+ LWD=sd.lwd[i],
+ LTY=sd.lty[i]
+ )
invisible( stdevs )
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|