
plot
in package RFsp
), explicit covariance models (objects of class RMmodel
),
empirical variograms (objects of class RFempVariog
) and fitted models (objects of class RFfit
).## S3 method for class 'RFspatialDataFrame,missing':
plot(x, y,
MARGIN=c(1,2), MARGIN.slices=NULL,
n.slices = if (is.null(MARGIN.slices)) 1 else 10,
nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), select.variables, zlim, legend=TRUE,
MARGIN.movie = NULL, ...)## S3 method for class 'RFspatialDataFrame,RFspatialGridDataFrame':
plot(x, y,
MARGIN=c(1,2), MARGIN.slices=NULL,
n.slices = if (is.null(MARGIN.slices)) 1 else 10,
nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), select.variables, zlim, legend=TRUE,
MARGIN.movie = NULL,...)
## S3 method for class 'RFspatialDataFrame,RFspatialPointsDataFrame':
plot(x, y,
MARGIN=c(1,2), MARGIN.slices=NULL,
n.slices = if (is.null(MARGIN.slices)) 1 else 10,
nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), select.variables, zlim, legend=TRUE,
MARGIN.movie = NULL,...)
## S3 method for class 'RFspatialDataFrame,matrix':
plot(x, y,
MARGIN=c(1,2), MARGIN.slices=NULL,
n.slices = if (is.null(MARGIN.slices)) 1 else 10,
nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), select.variables, zlim, legend=TRUE,
MARGIN.movie = NULL,...)
## S3 method for class 'RFspatialDataFrame,data.frame':
plot(x, y,
MARGIN=c(1,2), MARGIN.slices=NULL,
n.slices = if (is.null(MARGIN.slices)) 1 else 10,
nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), select.variables, zlim, legend=TRUE,
MARGIN.movie = NULL,...)
## S3 method for class 'RFspatialGridDataFrame':
persp(x, y,
MARGIN=c(1,2), MARGIN.slices=NULL,
n.slices = if (is.null(MARGIN.slices)) 1 else 10,
nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), select.variables, zlim, legend=TRUE,
MARGIN.movie = NULL,...)
## S3 method for class 'RFdataFrame,missing':
plot(x, y, nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), legend=TRUE, ...)
## S3 method for class 'RFdataFrame,RFdataFrame':
plot(x, y, nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), legend=TRUE, ...)
## S3 method for class 'RFdataFrame,matrix':
plot(x, y, nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), legend=TRUE, ...)
## S3 method for class 'RFdataFrame,data.frame':
plot(x, y, nmax=6,
plot.variance = (!is.null(x@.RFparams$has.variance) &&
x@.RFparams$has.variance), legend=TRUE, ...)
## S3 method for class 'RFempVariog,missing':
plot(x, model=NULL,
%nmax.phi=6, nmax.theta=3, nmax.T=3,
nmax.phi=NA, nmax.theta=NA, nmax.T=NA,
plot.nbin=TRUE, plot.sd=FALSE, variogram=TRUE, boundaries = TRUE,...)
## S3 method for class 'RFfit,missing':
plot(x, model=NULL, fit.method="ml",
nmax.phi=NA, nmax.theta=NA, nmax.T=NA,
plot.nbin=TRUE, plot.sd=FALSE, variogram = TRUE, boundaries = TRUE,...)
## S3 method for class 'RMmodel,missing':
plot(x, y, dim=1, n.points=200,
fct.type=NULL, MARGIN, fixed.MARGIN, maxchar=15, ...)
## S3 method for class 'RMmodel':
points(x, y, n.points=200, fct.type=NULL, ...)
## S3 method for class 'RMmodel':
lines(x, y, n.points=200, fct.type=NULL, ...)
RFsp
or
MARGIN.slices
can specify a third dimension w.r.t. which a
sequence of slices is plotted. Currently only works for grids.class(x)=="RMmodel"
and if
dim > 2
; a vector of length dim
-2 with distance values
for the coordinates that are not displayedn.slices>1
, nmax
is set to 1. Or n.slices
is a
vector of 3 elements: start, end, length. Currently only works for grids.x@.RFparams$n
iid copies
of the field that are to be plotted'RMmodel'
,
see Details.class(x)=="RFfit"
; a
vector of slot names for which the fitted covariance or variogram
model is to be plotted; should be a subset of
slotNames(x)
for which the corresponding slots are of class
class(x)=="RFempVario"
;
the maximal number of bins of angle phi that are to be
plottedclass(x)=="RFempVario"
;
the maximal number of bins of angle theta that are to be
plottedclass(x)=="RFempVario"
;
the maximal number of different time bins that are to be
plottedclass(x)=="RFempVario"
;
indicates whether the number of pairs per bin are to be plottedclass(x)=="RFempVario"
;
indicates whether the calculated standard deviation (x@sd
) is
to be plotted (in form of arrows of length +-1*sd)TRUE
then the empirical variogram
is plotted, else an estimate for the covariance functionclass(x)=="RFempVario"
and
the anisotropic case where model
is given.
As the empirical variogram is calculated on a sector of angles,
no exact variogram curve corresponds to the mean values in this
class(x)=="RMmodel"
; the
covariance function and the variogram are plotted as a function of
$\R^\code{dim}$.class(x)=="RMmodel"
; the
number of points at which the model
evaluated (in each dimension); defaults to 200class(x)=="RMmodel"
; must
equal NULL
, "Cov"
or "Variogram"
; controls
whether the covariance (fct.type="Cov"
) or the
variogram (fct.type="Variogram"
class(x)=="RFempVario"
or class(x)=="RFfit"
; a list of
covarianve or variogram models that are to be plotted into length(select.variables)
gives the number of pictures shown
(excuding the plot for the variances, if applicable).
If
zlim
can also be a character
wih the value ...
are passed to image
and
plot.default
, respectively; if, by default, multiple colors,
xlabs or ylabs are used, also vectors of suitable length can be
passed as col
, xlab
and ylab
, respectively. One exception is the use of ...
in 'RMmodel'
.
Here, further models might be passed. All models must have names
starting with model
. If '.'
is following in the name,
the part of the name after the dot is shown in the legend. Otherwise
the name is ignored and a standardized name derived from the model
definition is shown in the legend. Note that for the first argument
a name cannot be specified.
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
## RFoptions(seed=NA) to make them all random again
## define the model:
model <- RMtrend(mean=0.5) + # mean
RMstable(alpha=1, var=4, scale=10) + # see help("RMstable")
## for additional arguments
RMnugget(var=1) # nugget
#############################################################
## Plot of covariance structure
plot(model)
plot(model, xlim=c(0, 30))
plot(model, xlim=c(0, 30), fct.type="Variogram")
plot(model, xlim=c(-10, 20), fct.type="Variogram", dim=2)
#############################################################
## Plot of simulation results
## define the locations:
from <- 0
step <- .1
len <- if (interactive()) 50 else 3 # nicer, but also time consuming if len=100
x1D <- GridTopology(from, step, len)
x2D <- GridTopology(rep(from, 2), rep(step, 2), rep(len, 2))
x3D <- GridTopology(rep(from, 3), rep(step, 3), rep(len, 3))
## 1-dimensional
sim1D <- RFsimulate(model = model, x=x1D, n=6)
plot(sim1D, nmax=4)
## 2-dimensional
sim2D <- RFsimulate(model = model, x=x2D, n=6)
plot(sim2D, nmax=4)
plot(sim2D, nmax=4, col=terrain.colors(64),
main="My simulation", xlab="my_xlab")
## 3-dimensional
model <- RMmatern(nu=1.5, var=4, scale=2)
sim3D <- RFsimulate(model = model, x=x3D)
plot(sim3D, MARGIN=c(2,3), MARGIN.slices=1, n.slices=4)
#############################################################
## empirical variogram plots
x <- seq(0, 10, 0.05)
bin <- seq(from=0, by=.2, to=3)
model <- RMexp()
X <- RFsimulate(x=cbind(x), model=model)
ev1 <- RFempiricalvariogram(data=X, bin=bin)
plot(ev1)
model <- RMexp(Aniso = cbind(c(10,0), c(0,1)))
X <- RFsimulate(x=cbind(x,x), model=model)
ev2 <- RFempiricalvariogram(data=X, bin=bin, phi=3)
plot(ev2, model=list(exp = model))
#############################################################
## plot Fitting results
x <- seq(0, 2, len=if (interactive()) 21 else 6)
model <- RMexp(Aniso = cbind(c(10,0), c(0,1)))
X <- RFsimulate(x=cbind(x,x), model=model)
fit <- RFfit(~RMexp(Aniso=diag(c(NA, NA))), data=X, fit.nphi = 2,
modus="easygoing")
plot(fit)
#############################################################
## plot Kriging results
model <- RMwhittle(nu=1.2, scale=2)
n <- if (interactive()) 200 else 5
x <- runif(n, max=step*len/2)
y <- runif(n, max=step*len/2) # 200 points in 2 dimensional space
sim <- RFsimulate(model = model, x=x, y=y)
interpolate <- RFinterpolate(model=model, x=x2D, data=sim)
plot(interpolate)
plot(interpolate, sim)
#############################################################
## plotting vector-valued results
model <- RMdivfree(RMgauss(), scale=4)
x <- y <- seq(-10,10, if (interactive()) 0.5 else 10)
simulated <- RFsimulate(model = model, x=x, y=y, n=1)
plot(simulated)
plot(simulated, select.variables=list(1, 1:3, 4))
#############################################################
## options for the zlim argument
model <- RMdelay(RMstable(alpha=1.9, scale=2), s=c(0, 4)) +
RMdelay(RMstable(alpha=1.9, scale=2), s=c(4, 0))
simu <- RFsimulate(model, x, y)
plot(simu, zlim=list(data=cbind(c(-6,2), c(-2,1)), var=c(5,6)))
plot(simu, zlim=cbind(c(-6,2), c(-2,1)))
plot(simu, zlim=c(-6,2))
plot(simu, zlim="joint")
FinalizeExample()
Run the code above in your browser using DataLab