[Distr-commits] r1200 - in branches/distr-2.8/pkg/distrSim: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jul 12 18:52:57 CEST 2018
Author: ruckdeschel
Date: 2018-07-12 18:52:56 +0200 (Thu, 12 Jul 2018)
New Revision: 1200
Modified:
branches/distr-2.8/pkg/distrSim/R/plot-methods.R
branches/distr-2.8/pkg/distrSim/inst/NEWS
branches/distr-2.8/pkg/distrSim/man/plot-methods.Rd
Log:
[distrSim] branch 2.8
plot methods now return an S3 object of class \code{c("plotInfo","DiagnInfo")}, i.e., a list containing the
information needed to produce the respective plot, which at a later stage could be used by different graphic engines (like, e.g.
\code{ggplot}) to produce the plot in a different framework. A more detailed description will follow in a subsequent version.
Modified: branches/distr-2.8/pkg/distrSim/R/plot-methods.R
===================================================================
--- branches/distr-2.8/pkg/distrSim/R/plot-methods.R 2018-07-12 16:50:35 UTC (rev 1199)
+++ branches/distr-2.8/pkg/distrSim/R/plot-methods.R 2018-07-12 16:52:56 UTC (rev 1200)
@@ -12,8 +12,11 @@
function(x, obs0=1:samplesize(x), dims0=1:obsDim(x),
runs0=1:runs(x), ...){
- dots <- match.call(call = sys.call(sys.parent(1)),
+ args0 <- list(x=x, obs0=obs0, dims0=dims0, runs0=runs0)
+ mc <- match.call(call = sys.call(sys.parent(1)))
+ dots <- match.call(call = sys.call(sys.parent(1)),
expand.dots = FALSE)$"..."
+ plotInfo <- list(call = mc, dots=dots, args=args0)
doEnd <- FALSE
if(!is.null(dots[["panel.first"]]))
{doEnd<- TRUE
@@ -91,18 +94,28 @@
dots[["pch"]] <- pch0
dots[["col"]] <- col0
+ plotInfo$dotsMatplot <- vector("list",lrun0)
+ plotInfo$usrMatplot <- vector("list",lrun0)
+
for( i in 1: lrun0)
{ if (wylim) dots[["ylim"]] <- ylim0[,i]
dots[["y"]] <- Data(x)[, dims0[1:ldim0], runs0[i]]
+ plotInfo$dotsMatplot[[i]] <- dots
do.call("matplot", args = dots)
- }
+ plotInfo$usrMatplot[[i]] <- par("usr")
+ }
# }
- if(doEnd)
- {dots[["add"]] <- TRUE;
+ if(doEnd){
+ dots[["add"]] <- TRUE;
par(new=T)
- do.call("matplot", args = dots)}
+ do.call("matplot", args = dots)
+ plotInfo$dotsEnd <- dots
+ plotInfo$usrEnd[[i]] <- par("usr")
+ }
-
+ class(plotInfo) <- c("plotInfo","DiagnInfo")
+ return(invisible(plotInfo))
+
})
@@ -123,11 +136,19 @@
function(x, obs0=1:samplesize(x), dims0=1:obsDim(x),
runs0 = 1:runs(x), ...){
+ args0 <- list(x=x, obs0=obs0, dims0=dims0, runs0=runs0)
+ mc <- match.call(call = sys.call(sys.parent(1)))
+ dots <- match.call(call = sys.call(sys.parent(1)),
+ expand.dots = FALSE)$"..."
if(is.null(Data(x)))
stop("No Data found -> simulate first")
- plot(as(x,"Dataclass"), y = NULL, obs0 = obs0, dims0 = dims0,
- runs0 = runs0, ...)
+ ret <- plot(as(x,"Dataclass"), y = NULL, obs0 = obs0, dims0 = dims0,
+ runs0 = runs0, ...)
+ ret$call <- mc
+ ret$dots <- dots
+ ret$args <- args0
+ return(invisible(ret))
})
@@ -138,8 +159,12 @@
function(x, obs0=1:samplesize(x), dims0=1:obsDim(x),
runs0=1:runs(x), ...){
- dots <- match.call(call = sys.call(sys.parent(1)),
+ args0 <- list(x=x, obs0=obs0, dims0=dims0, runs0=runs0)
+ mc <- match.call(call = sys.call(sys.parent(1)))
+ dots <- match.call(call = sys.call(sys.parent(1)),
expand.dots = FALSE)$"..."
+ plotInfo <- list(call = mc, dots=dots, args=args0)
+
doEnd <- FALSE
if(!is.null(dots[["panel.first"]]))
{doEnd<- TRUE
@@ -246,6 +271,10 @@
} else dots[["add"]] <- TRUE
# plot.new()
+ plotInfo$dotsMatplot <- vector("list",lrun0)
+ plotInfo$usrMatplot <- vector("list",lrun0)
+ plotInfo$dotsCMatpoints <- vector("list",lrun0)
+
for( i in 1: lrun0)
{ ### if(wylim)
dots[["ylim"]] <- ylim0[,i]
@@ -253,21 +282,28 @@
dots[["cex"]] <- cex.id0
dots[["pch"]] <- pch.id0
dots[["col"]] <- col.id0
+ plotInfo$dotsMatplot[[i]] <- dots
do.call("matplot", args = dots)
-
+ plotInfo$usrMatplot[[i]] <- par("usr")
+
if(any(x.c[,dims0[1:ldim0],runs0[i]] != Inf))
{ dots[["cex"]] <- cex.c0
dots[["pch"]] <- pch.c0
dots[["col"]] <- col.c0
dots[["y"]] <- x.c[, dims0[1:ldim0], runs0[i]]
- do.call("matpoints", args = dots)
+ plotInfo$dotsMatpoints[[i]] <- dots
+ do.call("matpoints", args = dots)
}
}
# }
- if(doEnd)
- {dots[["add"]] <- TRUE;
+ if(doEnd){
+ dots[["add"]] <- TRUE;
par(new=T)
- do.call("matplot", args = dots)}
-
+ do.call("matplot", args = dots)
+ plotInfo$dotsEnd <- dots
+ plotInfo$usrEnd[[i]] <- par("usr")
+ }
+ class(plotInfo) <- c("plotInfo","DiagnInfo")
+ return(invisible(plotInfo))
})
Modified: branches/distr-2.8/pkg/distrSim/inst/NEWS
===================================================================
--- branches/distr-2.8/pkg/distrSim/inst/NEWS 2018-07-12 16:50:35 UTC (rev 1199)
+++ branches/distr-2.8/pkg/distrSim/inst/NEWS 2018-07-12 16:52:56 UTC (rev 1200)
@@ -8,6 +8,17 @@
information)
##############
+v 2.8
+##############
+
+user-visible CHANGES:
+
+plot methods now return an S3 object of class \code{c("plotInfo","DiagnInfo")}, i.e., a list containing the
+information needed to produce the respective plot, which at a later stage could be used by different graphic engines (like, e.g.
+\code{ggplot}) to produce the plot in a different framework. A more detailed description will follow in a subsequent version.
+
+
+##############
v 2.7
##############
Modified: branches/distr-2.8/pkg/distrSim/man/plot-methods.Rd
===================================================================
--- branches/distr-2.8/pkg/distrSim/man/plot-methods.Rd 2018-07-12 16:50:35 UTC (rev 1199)
+++ branches/distr-2.8/pkg/distrSim/man/plot-methods.Rd 2018-07-12 16:52:56 UTC (rev 1200)
@@ -41,6 +41,14 @@
}
}
}}
+\value{An S3 object of class \code{c("plotInfo","DiagnInfo")}, i.e., a list
+ containing the information needed to produce the
+ respective plot, which at a later stage could be used by different
+ graphic engines (like, e.g. \code{ggplot}) to produce the plot
+ in a different framework. A more detailed description will follow in
+ a subsequent version.
+}
+
\keyword{methods}
\keyword{hplot}
\concept{simulation}
More information about the Distr-commits
mailing list