plot-methods
plot(x, y, ...)
# S4 method for IC,missing
plot(x, ..., withSweave = getdistrOption("withSweave"),
main = FALSE, inner = TRUE, sub = FALSE,
col.inner = par("col.main"), cex.inner = 0.8,
bmar = par("mar")[1], tmar = par("mar")[3],
with.automatic.grid = TRUE,
with.legend = FALSE, legend = NULL, legend.bg = "white",
legend.location = "bottomright", legend.cex = 0.8,
withMBR = FALSE, MBRB = NA, MBR.fac = 2, col.MBR = par("col"),
lty.MBR = "dashed", lwd.MBR = 0.8,
x.vec = NULL, scaleX = FALSE, scaleX.fct, scaleX.inv,
scaleY = FALSE, scaleY.fct = pnorm, scaleY.inv=qnorm,
scaleN = 9, x.ticks = NULL, y.ticks = NULL,
mfColRow = TRUE, to.draw.arg = NULL,
withSubst = TRUE)
# S4 method for IC,numeric
plot(x, y, ...,
cex.pts = 1, cex.pts.fun = NULL, col.pts = par("col"),
pch.pts = 19,
cex.npts = 1, cex.npts.fun = NULL, col.npts = par("col"),
pch.npts = 20,
jitter.fac = 1, with.lab = FALSE, cex.lbs = 1, adj.lbs = c(0,0),
col.lbs = col.pts, lab.pts = NULL, lab.font = NULL,
alpha.trsp = NA, which.lbs = NULL,
which.Order = NULL, which.nonlbs = NULL, attr.pre = FALSE,
return.Order = FALSE)
An S3 object of class 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. ggplot
) to produce the plot
in a different framework. A more detailed description will follow in
a subsequent version.
object of class "IC"
: IC to be plotted
missing or numeric (a dataset, e.g.)
logical: if TRUE
(for working with Sweave
)
no extra device is opened
logical: is a main title to be used? or
just as argument main
in plot.default
.
logical: do panels have their own titles? or
character vector of inner titles/ cast to length 'number of plotted
dimensions';
if argument to.draw.arg
is used, this refers to
a vector of length length(to.draw.arg)
, the
actually plotted dimensions. For further information, see also
description of argument main
in plot.default
.
logical: is a sub-title to be used? or
just as argument sub
in plot.default
.
top margin -- useful for non-standard main title sizes
bottom margin -- useful for non-standard sub title sizes
magnification to be used for inner titles relative
to the current setting of cex
; as in
par
character or integer code; color for the inner title
logical; should a grid be plotted alongside
with the ticks of the axes, automatically? If TRUE
a respective
call to grid
in argument panel.first
is ignored.
logical; shall a legend be plotted?
either NULL
or a list of length (number of plotted panels)
of items which can be used as argument legend
in
command legend
.
a valid argument x
for legend
---
the place where to put the legend on the last issued
plot --- or a list of length (number of plotted panels)
of such arguments, one for each plotted panel.
background color for the legend
magnification factor for the legend
logical; shall horizontal lines with min and max of MBRE be plotted for comparison?
matrix (or NA
); coerced by usual recycling rules to a
matrix with as many rows as plotted panels and with first column
the lower bounds and the second column the upper bounds for the
respective coordinates (ideally given by the MBR-IC).
positive factor; scales the bounds given by argument MBRB
color for the MBR lines; as usual col
-argument;
line type for the MBR lines; as usual lty
-argument;
line width for the MBR lines; as usual lwd
-argument;
a numeric vector of grid points to evaluate the influence curve;
by default, x.vec
is NULL
; then the grid is
produced automatically according to the distribution of the IC.
x.vec
can be useful for usage with a rescaling of the
x-axis to avoid that the evaluation points be selected too
unevenly (i.e. on an equally spaced grid in the original scale,
but then, after rescaling non-equally).
The grid has to be specified in original scale; i.e.; when used
with rescaling, it should be chosen non-equally spaced.
logical; shall X-axis be rescaled (by default according to the cdf of the underlying distribution)?
logical; shall Y-axis be rescaled (by default according to a probit scale)?
an isotone, vectorized function mapping the domain of the IC
to [0,1]; if scaleX
is TRUE
and scaleX.fct
is
missing, the cdf of the underlying observation distribution;
can also be a list of functions with one list element for each
of the panels to be plot.
the inverse function to scale.fct
, i.e., an isotone,
vectorized function mapping [0,1] to the domain of the IC
such that for any x
in the domain,
scaleX.inv(scaleX.fct(x))==x
; if scaleX
is TRUE
and scaleX.inv
is
missing, the quantile function of the underlying observation distribution;
can also be a list of functions with one list element for each
of the panels to be plot.
an isotone, vectorized function mapping for each coordinate the range of the respective coordinate of the IC to [0,1]; defaulting to the cdf of \({\cal N}(0,1)\).
an isotone, vectorized function mapping for each coordinate the range [0,1] into the range of the respective coordinate of the IC; defaulting to the quantile function of \({\cal N}(0,1)\).
integer; defaults to 9; on rescaled axes, number of x and y ticks if drawn automatically;
numeric; defaults to NULL; (then ticks are chosen automatically); if non-NULL, user-given x-ticks (on original scale);
numeric; defaults to NULL; (then ticks are chosen automatically); if non-NULL, user-given y-ticks (on original scale); can be a list with one (numeric or NULL) item per panel
shall default partition in panels be used --- defaults to TRUE
Either NULL
(default;
everything is plotted) or a vector of either integers
(the indices of the subplots to be drawn) or characters
--- the names of the subplots to be drawn: these
names are to be chosen either among the row names of
the trafo matrix
rownames(trafo(eval(x@CallL2Fam)@param))
or if the last expression is NULL
a
vector "dim<dimnr>"
, dimnr
running through
the number of rows of the trafo matrix.
logical; if TRUE
(default) pattern substitution for
titles and lables is used; otherwise no substitution is used.
size of the points of the second argument plotted, can be a vector;
if argument attr.pre
is TRUE
, it is recycled to the length
of all observations and determines the sizes of all plotted symbols,
i.e., the selection is done within this argument; in this case argument
col.npts
is ignored. If attr.pre
is FALSE
,
cex.pts
is recycled to the number of the observations selected
for labelling and refers to the index ordering after the
selection. Then argument cex.npts
deteremines the sizes
of the shown but non-labelled observations as given in argument
which.nonlbs
.
rescaling function for the size of the points to be plotted;
either NULL
(default), then log(1+abs(x))
is used for each of
the rescalings, or a function which is then used for each of the
rescalings, or a list of functions; if it is a function or a list of
functions, if necessary it is recylced to length dim
where dim
is the number of dimensions of the pICs to be plotted.
color of the points of the second argument plotted, can
be a vector as in cex.pts
(with col.npts
as counterpart).
symbol of the points of the second argument plotted, can
be a vector as in cex.pts
(with pch.npts
as counterpart).
color of the non-labelled points of the data
argument
plotted; (may be a vector).
symbol of the non-labelled points of the data
argument
plotted (may be a vector).
size of the non-labelled points of the data
argument
plotted (may be a vector).
rescaling function for the size of the non-labelled points
to be plotted; either NULL
(default), then log(1+abs(x))
is used for each of the rescalings, or a function which is then used
for each of the rescalings, or a list of functions; if it is a
function or a list of functions, if necessary it is recylced
to length dim
where dim
is the number of dimensions of
the pICs to be plotted.
logical; shall labels be plotted to the observations?
size of the labels; can be vectorized to a matrix of dim nlbs x npnl where npnl is the number of plotted panels and nlbs the number of plotted labels; if it is a vector, it is recylced in order label then panel.
color of the labels; can be vectorized as col.pts
.
adjustment of the labels; can be vectorized to a 2 x npnl matrix, npnl the number of plotted panels; if it is a vector, it is recycled in order (x,y)-coords then panel.
character or NULL; labels to be plotted to the observations; if NULL
observation indices;
font to be used for labels (of the observations).
alpha transparency to be added ex post to colors
col.pch
and col.lbl
; if one-dim and NA all colors are
left unchanged. Otherwise, with usual recycling rules alpha.trsp
gets shorted/prolongated to length the data-symbols to be plotted.
Coordinates of this vector alpha.trsp
with NA are left unchanged,
while for the remaining ones, the alpha channel in rgb space is set
to the respective coordinate value of alpha.trsp
. The non-NA
entries must be integers in [0,255] (0 invisible, 255 opaque).
jittering factor used in case of a DiscreteDistribution
for plotting points of the second argument in a jittered fashion.
logical; do graphical attributes for plotted data refer
to indices prior (TRUE
) or posterior to selection
via arguments which.lbs
, which.Order
, which.nonlbs
(FALSE
)?
either an integer vector with the indices of the observations
to be plotted into graph or NULL
--- then no observation is excluded
we order the observations (descending) according to the norm given by
normtype(object)
; then which.Order
either is an integer vector with the indices of the ordered
observations (remaining after a possible reduction by argument which.lbs
)
to be plotted (with labels) into graph or NULL
--- then no (further)
observation is excluded.
indices of the observations which should be plotted but
not labelled; either an integer vector with the indices of the observations
to be plotted into graph or NULL
--- then all non-labelled
observations are plotted
logical; if TRUE
, an order vector
is returned; more specifically, the order of the (remaining) observations
given by their original index is returned (remaining means: after a possible
reduction by argument which.lbs
, and ordering is according to the norm given by
normtype(object)
);
otherwise we return invisible()
as usual.
further parameters for plot
Any parameters of plot.default
may be passed on to this particular
plot
method.
We start describing the IC,missing
-method:
For main-, inner, and subtitles given as arguments main
,
inner
, and sub
, top and bottom margins are enlarged to 5 resp.
6 by default but may also be specified by tmar
/ bmar
arguments.
If main
/ inner
/ sub
are
logical then if the respective argument is FALSE
nothing is done/plotted,
but if it is TRUE
, we use a default main title taking up the calling
arguments in case of main
, default inner titles taking up the
class and (named) parameter slots of arguments in case of inner
,
and a "generated on <data>"-tag in case of sub
.
Of course, if main
/ inner
/ sub
are character
, this
is used for the title; in case of inner
it is then checked whether it
has correct length. If argument withSubst
is TRUE
, in all title
and axis lable arguments, the following patterns are substituted:
"%C"
class of argument object
"%A"
deparsed argument object
"%D"
time/date-string when the plot was generated
If argument ...
contains argument ylim
, this may either be
as in plot.default
(i.e. a vector of length 2) or a vector of
length 2*(number of plotted dimensions + 2),
where the first two elements are the values for ylim
in panel "d", the first two are for ylim
resp. xlim
for panels "p" and "q", and the last 2*(number of plotted dimensions)
are the values for ylim
for the plotted dimensions of the L2derivative,
one pair for each dimension.
The IC,numeric
-method calls the IC,missing
-method but in
addition plots the values of a dataset into the IC.
In addition, argument ...
may contain arguments panel.first
,
panel.last
, i.e., hook expressions to be evaluated at the very beginning
and at the very end of each panel (within the then valid coordinates).
To be able to use these hooks for each panel individually, they may also be
lists of expressions (of the same length as the number of panels and
run through in the same order as the panels).
IC1 <- new("IC")
plot(IC1)
plot(IC1, main = TRUE, panel.first= grid(),
col = "blue", cex.main = 2, cex.inner = 1)
### selection of subpanels for plotting
N <- NormLocationScaleFamily(mean=0, sd=1)
IC2 <- optIC(model = N, risk = asCov())
par(mfrow=c(1,1))
plot(IC2, main = TRUE, panel.first= grid(),
col = "blue", cex.main = 2, cex.inner = 0.6,
mfColRow = FALSE, to.draw.arg=c("sd"))
## xlim and ylim arguments
plot(IC2, main = TRUE, panel.first= grid(),
ylim=c(-3,3), xlim=c(-2,3))
plot(IC2, main = TRUE, panel.first= grid(),
ylim=c(-3,3,-1,3), xlim=c(-2,3),
with.legend = TRUE)
data <- r(N)(30)
plot(IC2, data, panel.first= grid(),
ylim = c(-3,3,-1,3), xlim=c(-2,3),
cex.pts = 3, pch.pts = 1:2, col.pts="green",
with.lab = TRUE, which.lbs = c(1:4,15:20),
which.Order = 1:6, return.Order = TRUE)
Run the code above in your browser using DataLab