plot-methods {RobAStBase} | R Documentation |
Methods for Function plot in Package ‘RobAStBase’
Description
plot-methods
Usage
plot(x, y, ...)
## S4 method for signature '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 signature '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)
Arguments
x |
object of class |
y |
missing or numeric (a dataset, e.g.) |
withSweave |
logical: if |
main |
logical: is a main title to be used? or |
inner |
logical: do panels have their own titles? or |
sub |
logical: is a sub-title to be used? or |
tmar |
top margin – useful for non-standard main title sizes |
bmar |
bottom margin – useful for non-standard sub title sizes |
cex.inner |
magnification to be used for inner titles relative
to the current setting of |
col.inner |
character or integer code; color for the inner title |
with.automatic.grid |
logical; should a grid be plotted alongside
with the ticks of the axes, automatically? If |
with.legend |
logical; shall a legend be plotted? |
legend |
either |
legend.location |
a valid argument |
legend.bg |
background color for the legend |
legend.cex |
magnification factor for the legend |
withMBR |
logical; shall horizontal lines with min and max of MBRE be plotted for comparison? |
MBRB |
matrix (or |
MBR.fac |
positive factor; scales the bounds given by argument |
col.MBR |
color for the MBR lines; as usual |
lty.MBR |
line type for the MBR lines; as usual |
lwd.MBR |
line width for the MBR lines; as usual |
x.vec |
a numeric vector of grid points to evaluate the influence curve;
by default, |
scaleX |
logical; shall X-axis be rescaled (by default according to the cdf of the underlying distribution)? |
scaleY |
logical; shall Y-axis be rescaled (by default according to a probit scale)? |
scaleX.fct |
an isotone, vectorized function mapping the domain of the IC
to [0,1]; if |
scaleX.inv |
the inverse function to |
scaleY.fct |
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 |
scaleY.inv |
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 |
scaleN |
integer; defaults to 9; on rescaled axes, number of x and y ticks if drawn automatically; |
x.ticks |
numeric; defaults to NULL; (then ticks are chosen automatically); if non-NULL, user-given x-ticks (on original scale); |
y.ticks |
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 |
mfColRow |
shall default partition in panels be used — defaults to |
to.draw.arg |
Either |
withSubst |
logical; if |
cex.pts |
size of the points of the second argument plotted, can be a vector;
if argument |
cex.pts.fun |
rescaling function for the size of the points to be plotted;
either |
col.pts |
color of the points of the second argument plotted, can
be a vector as in |
pch.pts |
symbol of the points of the second argument plotted, can
be a vector as in |
col.npts |
color of the non-labelled points of the |
pch.npts |
symbol of the non-labelled points of the |
cex.npts |
size of the non-labelled points of the |
cex.npts.fun |
rescaling function for the size of the non-labelled points
to be plotted; either |
with.lab |
logical; shall labels be plotted to the observations? |
cex.lbs |
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. |
col.lbs |
color of the labels; can be vectorized as |
adj.lbs |
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. |
lab.pts |
character or NULL; labels to be plotted to the observations; if |
lab.font |
font to be used for labels (of the observations). |
alpha.trsp |
alpha transparency to be added ex post to colors
|
jitter.fac |
jittering factor used in case of a |
attr.pre |
logical; do graphical attributes for plotted data refer
to indices prior ( |
which.lbs |
either an integer vector with the indices of the observations
to be plotted into graph or |
which.Order |
we order the observations (descending) according to the norm given by
|
which.nonlbs |
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 |
return.Order |
logical; if |
... |
further parameters for |
Details
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).
Value
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.
Examples
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)