https://github.com/cran/simecol
Tip revision: b6e4580db4360e59ff8135eda8a7c78f824a4f12 authored by Thomas Petzoldt on 21 January 2007, 00:00:00 UTC
version 0.4-2
version 0.4-2
Tip revision: b6e4580
plot.R
## plotting methods for simObj'ects
setMethod("plot", c("simObj", "missing"),
function(x, y, ...) {
warning("No default plot method available for this class.\n",
" Please write your own plot method\n",
" or use standard routines with extracted oputput data.")
}
)
setMethod("plot", c("odeModel", "missing"),
function(x, y, ...) {
oldpar <- par(no.readonly=TRUE)
on.exit(par(oldpar))
out <- as.data.frame(x@out)
nstates <- ncol(out) - 1
## one figure per page if nstates = 1
## two figures if nstates = 2
## four figures if nstates > 2
par(mfrow=c(1 + (nstates > 1), 1 + (nstates > 2)))
nam <- names(out)
for (i in 1:nstates) {
graphics:::plot(out[[1]], out[[i+1]],
type="l", xlab=nam[1], ylab=nam[i+1], ...)
if ((i %%4) ==0 & nstates > i) readline("press return for next page")
}
}
)
setMethod("plot", c("gridModel", "missing"),
function(x, y, index=1:length(x@out), delay=0, ...) {
oldpar <- par(no.readonly=TRUE)
on.exit(par(oldpar))
for (i in index) {
image(x@out[[i]], main=i, ...)
Sys.sleep(0.001*delay)
}
}
)
setMethod("plot", c("rwalkModel", "missing"),
function(x, y, index=1:length(x@out), delay=0, ...) {
oldpar <- par(no.readonly=TRUE)
on.exit(par(oldpar))
for (i in index) {
graphics:::plot(x@out[[i]]$x, x@out[[i]]$y,
xlim = x@parms$area[c(1,3)],
ylim = x@parms$area[c(2,4)],
xlab="x", ylab="y", main=i, ...)
Sys.sleep(0.001*delay)
}
}
)