diff options
author | Suraj Yerramilli | 2015-02-07 01:18:26 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-02-07 01:18:26 +0530 |
commit | 874b3143a745cdd135ef2baacc812fffb46f2ddd (patch) | |
tree | 7426f7d3a9ecf3de0a01cda2aeb607276128f487 | |
parent | f9b0b6607be23df7929acab838767a62b502bfbd (diff) | |
download | SysID-R-code-874b3143a745cdd135ef2baacc812fffb46f2ddd.tar.gz SysID-R-code-874b3143a745cdd135ef2baacc812fffb46f2ddd.tar.bz2 SysID-R-code-874b3143a745cdd135ef2baacc812fffb46f2ddd.zip |
fixed bug in plot function
-rw-r--r-- | R/idframe.R | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/R/idframe.R b/R/idframe.R index 7ccdf58..22c663d 100644 --- a/R/idframe.R +++ b/R/idframe.R @@ -69,29 +69,30 @@ plot.idframe <- function(object,...){ p <- dim(object$output)[2];m <- dim(object$input)[2] - if(p!=1 && m!=1){ + if(p!=1 || m!=1){ oask <- devAskNewPage(TRUE) on.exit(devAskNewPage(oask)) for(i in seq(m)){ for(j in seq(p)){ - par(mfrow=c(2,1),mar=c(3,4,3,2)) - plot(.index(object),object$output[,j],xlab=object$type, + par(mfrow=c(2,1),mar=c(3,4,2,2)) + plot(index(object),object$output[,j],xlab=object$type, ylab=colnames(object$output)[j],type="l",...) - plot(.index(object),object$input[,i],xlab=object$type, + plot(index(object),object$input[,i],xlab=object$type, ylab=colnames(object$input)[i],type="l",...) } } } else { - par(mfrow=c(2,1)) - plot(.index(object),object$output[,1],xlab=object$type, + par(mfrow=c(2,1),mar=c(3,4,3,2)) + plot(index(object),object$output[,1],xlab=object$type, ylab=colnames(object$output),type="l",...) - plot(.index(object),object$input[,1],xlab=object$type, + plot(index(object),object$input[,1],xlab=object$type, ylab=colnames(object$input),type="l",...) } } -.index <- function(object){ +#' @export +index <- function(object){ if(object$type=="time"){ return(seq(from=object$t.start,to=object$t.end,by=object$Ts)) } else { |