Learn R Programming

RobAStBase (version 1.2.6)

internals_for_RobAStBase_plot: Internal / Helper functions of package RobAStBase for plot functions

Description

These functions are internally used helper functions for plot, infoPlot comparePlot in package RobAStBase.

Usage

.rescalefct(x, fct, scaleX = FALSE, scaleX.fct, scaleX.inv,
         scaleY = FALSE, scaleY.fct = pnorm,
         xlim, ylim, dots)
.plotRescaledAxis(scaleX, scaleX.fct, scaleX.inv, scaleY,scaleY.fct,
                  scaleY.inv, xlim, ylim, X, ypts = 400, n = 11,
                  finiteEndpoints = rep(FALSE,4),
                  x.ticks = NULL, y.ticks = NULL, withbox = TRUE)
.legendCoord(x, scaleX, scaleX.fct, scaleY, scaleY.fct)
.SelectOrderData(data, fct, which.lbs, which.Order, which.nonlbs = NULL)
.makedotsP(dots)
.makedotsLowLevel(dots)
.cexscale(y, y1=y, maxcex=4,mincex=0.05,cex, fun=NULL)
.getX.vec(distr, dims0, lty, x.vec, scaleX, scaleX.fct, scaleX.inv, xm, xM)
.getXlimYlim(dots,dotsP, dims0, xlim, ylim)
.prepareTitles(withSubst, presubArg2, presubArg3, dots, mainText,
               L2Fam, inner, dims0, dims, to.draw, trafO, obj, type, bmar, tmar)
.getToDraw(dims, trafO, L2Fam, to.draw.arg, Abs=NULL)
.preparePanelFirstLast(with.automatic.grid , dims0, pF.0, pL.0,
            logArg, scaleX, scaleY, x.ticks, y.ticks, scaleX.fct, scaleY.fct)

Arguments

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 is TRUE and scaleX.fct is missing, the cdf of the underlying observation distribution.

scaleX.inv

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.

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 \({\cal N}(0,1)\).

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 \({\cal N}(0,1)\).

fct

for .rescalefct: (vectorized) function from reals to reals: function to produce y values. for .SelectOrderData: (vectorized) function from data to reals: function to produce the ordering.

xlim

for one-panel plots: numeric vector of length 2: limits of the plotted x region (in original scale), for multi-panel plots: can be matrix valued (with two columns and as many rows as panels).

ylim

for one-panel plots: numeric vector of length 2: limits of the plotted y region (in original scale), for multi-panel plots: can be matrix valued (with two columns and as many rows as panels).

finiteEndpoints

a logical of length 4: are the unscaled xlim[1], xlim[2], ylim[1], ylim[2] finite?

x.ticks

numeric: coordinates in original scale of user-given ticks on x-axis.

y.ticks

numeric: coordinates in original scale of user-given ticks on y-axis.

n

integer: number of default ticks in x and y axis.

X

numeric: x-values on [0,1]-scale from which to produce range of x axis.

ypts

integer: number of y-points to be generated on [0,1] range to produce y-axis.

dots

dots argument for later calls to plot which is manipulated when using rescaling.

x

coordinates of the legend placement to be rescaled when using a scale transformation.

data

numeric or data.frame containing numerics; observations to be plotted into a graph.

which.lbs

either an integer vector with the indices of the observations to be plotted into graph or NULL --- then no observation is excluded

which.Order

indices of the observations after ordering which are to be plotted into the graph; more speficically, the indices are obtained after a possible thin-out by which.lbs and after ordering in descending order of the remaining observations. If this argument is NULL then no (further) observation is excluded.

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 NULL --- then all non-labelled observations are plotted.

withbox

logical of length 1. If TRUE, even if scaleX and scaleY are both FALSE and, simultaneously, x.ticks and y.ticks are both NULL, a respective box is drawn around the panel; otherwise no box is drawn in this case.

y

input at which to compute cex-values (for these y values)

y1

secondary input of y-values which is also used for computaiton but not plotted itself at this cex value.

maxcex

maximal value for cex

mincex

minimal value for cex

cex

basic factor for cex

fun

(optional) function to compute the cex-values acc. to the y and y1-values.

L2Fam

L2-Family

,

to.draw.arg

resp. argument from the user-interface of comparePlot, infoPlot, and the plot-method for ICs, i.e., 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.

distr

underlying distribution of the observations

dims0

number of panels to be plotted

lty

the lty argument used in the user interface

x.vec

the resp. argument from the user interface.

xm

minimal x-value

xM

maximal x-value

dotsP

the internal dotsP-variable to be changed (taking up additional arguments for the calls to plot); see also Details section.

withSubst

should substitutions be made in titles?

presubArg2

title part

presubArg3

title part

mainText

text to be used for main

inner

the resp. argument from the user interface.

dims

the dimension of the pIC

to.draw

the actual numbers / names of the plotted panels.

trafO

the parameter transformation of L2fam@param.

obj

the object from which to draw the name (of the plot).

type

for which type of plot should the titles be produced -- "info", "all" or compare.

bmar

resp. argument from the user-interface of comparePlot, infoPlot, and the plot-method for ICs.

tmar

resp. argument from the user-interface of comparePlot, infoPlot, and the plot-method for ICs.

Abs

additional text template used in infoPlot.

with.automatic.grid

generate a grid automatically.

pF.0

the panel.first expression given by rhe user

pL.0

the panel.last expression given by rhe user

logArg

a character vector with log-arguments for plot for each of the plotted panels.

Author

Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de

Details

.rescalefct rescales, if necessary, x and y axis for use in plot functions. More specifically, if scaleX is TRUE rescales x, if scaleY is TRUE rescales fct(x) (otherwise leaves them unchanges); to this end uses trafos scaleX.fct with inverse scaleX.inv, resp. scaleY.fct; it respects xlim and ylim (given in orig. scale), thins out the scaled values if necessary and accordingly modifies slots xaxt, yaxt, and axes of argument dots to indicate the new axes have to be drawn; using the paradigm small letters to denote values on original scale and capital letters on transformed scale, its return value is a list with (thinned out) values of x and y, X and Y and modified dots.

.plotRescaledAxis plots rescaled axes according to logicals scaleX, scaleY; to this end uses trafos scaleX.fct with inverse scale.inv, resp. scaleY.fct, scaleY.inv; it respects xlim and ylim. By default, ot produces the x axes according to the values in argument X, and the y axes as an equidistant grid of length ypts on [0,1] (on transformed scale); each of these axes, again by default will have n tick values; these are however thinned out if the come to lie too close to each other on transformed scale. Instead of producing automatically chosen tick values, the user may explicitly require x-ticks and y-ticks values on the axes, using arguments x.ticks and y-ticks. This function has no return value.

.legendCoord produces, if needed (i.e., if coordinates are not given as strings like "bottomright"), rescaled coordinates for the placement of a legend.

.SelectOrderData, for data to be plotted into the graph, performs two optional selections: a first selection on the unordered (original) data (acc. to argument which.lbs) and a second selection according to which.Order on the data remaining after the first selection and ordered according to argument fct; the return value is a list with elements data, ie., the selected/thinned out data, y, ie., the values of fct(data), ind, ie., the indices of the selected data in the original data (after possibly two selections), and ind1 the indices of the data selected by which.lbs in the original data; in addition also the non selected data, data.ns, the respective y-values y.ns and the corresponding index elements ind.ns are returned as list items.

.makedotsP and .makedotsLowLevel manipulate the ... argument, deleting certain items and selecting items which can be digested by plot, returning the manipulated list.

.cexscale rescales the point sizes of the points to be plotted; the unscaled sizes are given in argument y, y1 in case of several lines of points to be plotted may contain the vector of the sizes of all points to be plotted in (e.g., including those of the other lines of points). maxcex and mincex are maximum and minimum of the raw rescaled sizes; cex is a factor drawn from argument cex.pts by which the raw sizes are rescaled before being returned. fun is the function by which the rescaling is done; by default this argument is NULL and in this case the function log(1+abs(x)) is used.

.getDimsTD returns the number of different coordinates to be plotted.

.producePanelFirstS for each graphical panel inserts (if needed) x and y tickmarks for user-specific axes into a panel.first expression.

.getX.vec produces the x-grid (on original scale) for each of the panels and decides whether to plot lines or points.

.getXlimYlim produces panel-wise xlim and ylim arguments as well as left and right endpoints of the x-scalas.

.prepareTitles produces the titles for the panels.

.getToDraw computes which panels are to be drawn. .preparePanelFirstLast prepares the panel.first and panel.last expressions for each of the panels.