plot-methods {distr}R Documentation

Methods for Function plot in Package ‘distr’

Description

plot-methods

Usage

plot(x, y, ...)
## S4 method for signature 'AbscontDistribution, missing':
plot(x, width = 10, height = 5.5,
     withSweave = getdistrOption("withSweave"), xlim = NULL, ylim = NULL, ngrid = 1000,
     verticals = TRUE, do.points = TRUE, main = FALSE, inner = TRUE,
     sub = FALSE, bmar = par("mar")[1], tmar = par("mar")[3], ...,
     cex.main = par("cex.main"), cex.inner = 1.2, cex.sub = par("cex.sub"), 
     col.points = par("col"), col.vert = par("col"), col.main = par("col.main"),  
     col.inner = par("col.main"), col.sub = par("col.sub"), cex.points = 2.0, 
     pch.u = 21, pch.a = 16, mfColRow = TRUE)
## S4 method for signature 'DiscreteDistribution, missing':
plot(x, width = 10, height = 5.5,
     withSweave = getdistrOption("withSweave"), xlim = NULL, ylim = NULL, verticals = TRUE,
     do.points = TRUE, main = FALSE, inner = TRUE, sub = FALSE, 
     bmar = par("mar")[1], tmar = par("mar")[3], ..., 
     cex.main = par("cex.main"), cex.inner = 1.2, cex.sub = par("cex.sub"), 
     col.points = par("col"), col.hor = par("col"), col.vert = par("col"), 
     col.main = par("col.main"), col.inner = par("col.main"), 
     col.sub = par("col.sub"),  cex.points = 2.0, pch.u = 21, pch.a = 16, mfColRow = TRUE)
## S4 method for signature 'AffLinUnivarLebDecDistribution,
##   missing':
plot(x, width = 10, 
     height = 5.5, withSweave = getdistrOption("withSweave"), xlim = NULL, ylim = NULL, ngrid = 1000,
     verticals = TRUE, do.points = TRUE, main = FALSE, inner = TRUE, sub = FALSE,
     bmar = par("mar")[1], tmar = par("mar")[3], ..., cex.main = par("cex.main"), 
     cex.inner = 1.2, cex.sub = par("cex.sub"), col.points = par("col"),
     col.hor = par("col"), col.vert = par("col"), col.main = par("col.main"), 
     col.inner = par("col.main"), col.sub = par("col.sub"),  cex.points = 2.0,
     pch.u = 21, pch.a = 16, mfColRow = TRUE)
## S4 method for signature 'UnivarLebDecDistribution,
##   missing':
plot(x, width = 10, 
     height = 14.5, withSweave = getdistrOption("withSweave"), xlim = NULL, ylim = NULL, ngrid = 1000,
     verticals = TRUE, do.points = TRUE, main = FALSE, inner = TRUE, sub = FALSE,
     bmar = par("mar")[1], tmar = par("mar")[3], ..., cex.main = par("cex.main"), 
     cex.inner = 0.9, cex.sub = par("cex.sub"), col.points = par("col"),
     col.hor = par("col"), col.vert = par("col"), col.main = par("col.main"), 
     col.inner = par("col.main"), col.sub = par("col.sub"),  cex.points = 2.0,
     pch.u = 21, pch.a = 16, mfColRow = TRUE)
## S4 method for signature 'DistrList, missing':
plot(x, y, ...)

Arguments

x object of class "AffLinUnivarLebDecDistribution" or class "UnivarLebDecDistribution" or class "AbscontDistribution" or class "DiscreteDistribution" or class "DistrList": (list of) distribution(s) to be plotted
y missing
xlim the x limits (x1, x2) of the plot. Note that x1 > x2 is allowed and leads to a "reversed axis". As in plot.default.
ylim the y limits of the plot. As in plot.default.
width width (in inches) of the graphics device opened
height height (in inches) of the graphics device opened
withSweave logical: if TRUE (for working with Sweave) no extra device is opened and height/width are not set
ngrid integer: number of grid points used for plots of absolutely continuous distributions
main logical: is a main title to be used? or
just as argument main in plot.default.
inner logical: panels for density/probability function - cdf - quantile function have their own titles? or
list of length 3: titles for density/probability function - cdf - quantile function (each of the same form as argument main in plot.default)
sub logical: is a sub-title to be used? or
just as argument sub in plot.default.
tmar top margin – useful for non-standard main title sizes
bmar bottom margin – useful for non-standard sub title sizes
verticals logical: if TRUE, draw vertical lines at steps; as in plot.stepfun
do.points logical: if TRUE, draw also draw points at the (xlim restricted) knot locations; as in plot.stepfun
cex.points numeric; character expansion factor; as in plot.stepfun
col.points character or integer code; color of points; as in plot.stepfun
col.hor character or integer code; color of horizontal lines; as in plot.stepfun
col.vert character or integer code; color of vertical lines; as in plot.stepfun
cex.main magnification to be used for main titles relative to the current setting of cex; as in par
cex.inner magnification to be used for inner titles relative to the current setting of cex; as in par
cex.sub magnification to be used for sub titles relative to the current setting of cex; as in par
col.main character or integer code; color for the main title
col.inner character or integer code; color for the inner title
col.sub character or integer code; color for the sub title
pch.u character or integer code; plotting characters or symbols for unattained value; see points
pch.a character or integer code; plotting characters or symbols for attained value; see points
mfColRow shall default partition in panels be used — defaults to TRUE
... addtional arguments for plot — see plot, plot.default, plot.stepfun

Details

plot
signature(x = "AffLinUnivarLebDecDistribution", y = "missing"): plots cumulative distribution function and the quantile function
plot
signature(x = "UnivarLebDecDistribution", y = "missing"): plots a set of eight plots: in the first row, it plots the cumulative distribution function and the quantile function; in the second row the absolutely continuous part (with density, cdf and quantile fct.), and in the last row the discrete part (with prob.fct., cdf and quantile fct.).
plot
signature(x = "AbscontDistribution", y = "missing"): plots density, cumulative distribution function and the quantile function
plot
signature(x = "DiscreteDistribution", y = "missing"): plots probability function, cumulative distribution function and the quantile function

Any parameters of plot.default may be passed on to this particular plot 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 argument x in case of main, default inner titles taking up the class and (named) parameter slots of argument x 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 length 3. In all title arguments, the following patterns are substituted:

If not explicitly set, col.points, col.vert, col.hor, col.main, col.inner, col.sub are set to col if this arg is given and else to par("col") resp. for the titles par("col.main"), par("col.main"), par("col.sub").

If not explicitly set, pch.a, pch.u are set to pch if this arg is given and else to 16, 21, respectively.

If not explicitly set, cex is set to 1. If not explicitly set, cex.points is set to $2.0 cex$ (if cex is given) and to 2.0 else.

See Also

plot,plot.default, plot.stepfun, par

Examples

plot(Binom(size = 4, prob = 0.3))
plot(Binom(size = 4, prob = 0.3), do.points = FALSE)
plot(Binom(size = 4, prob = 0.3), verticals = FALSE)
plot(Binom(size = 4, prob = 0.3), main = TRUE)
plot(Binom(size = 4, prob = 0.3), main = FALSE)
plot(Binom(size = 4, prob = 0.3), cex.points = 1.2, pch = 20)
B <- Binom(size = 4, prob = 0.3)
plot(B, col = "red", col.points = "green", main = TRUE, col.main = "blue", 
     col.sub = "orange", sub = TRUE, cex.sub = 0.6, col.inner = "brown")
plot(Nbinom(size = 4,prob = 0.3), cex.points = 1.2, col = "red", 
     col.points = "green")
plot(Nbinom(size = 4,prob = 0.3), cex.points = 1.2, pch.u = 20, pch.a = 10)
plot(Norm(), main = TRUE, cex.main = 3, tmar = 6)
plot(Norm(), inner = FALSE, main = TRUE, cex.main = 3, tmar = 6)
plot(Norm(), lwd = 3, col = "red", ngrid = 200, lty = 3, las = 2)
plot(Norm(), main = "my Distribution: %A", 
     inner = list(expression(paste(lambda,"-density of %C(%P)")), "CDF",
                  "Pseudo-inverse with param's %N"), 
     sub = "this plot was correctly generated on %D", 
     cex.inner = 0.9, cex.sub = 0.8)
plot(Cauchy())
plot(Cauchy(), xlim = c(-4,4))
plot(Chisq())
plot(Chisq(), log = "xy", ngrid = 100)
Ch <- Chisq(); setgaps(Ch); plot(Ch, do.points = FALSE)
setgaps(Ch, exactq = 3); plot(Ch, verticals = FALSE)
plot(Ch, cex = 1.2, pch.u = 20, pch.a = 10, col.points = "green", 
     col.vert = "red")

## some distribution with gaps
wg <- flat.mix(UnivarMixingDistribution(Unif(0,1),Unif(4,5), 
               withSimplify=FALSE))
# some Lebesgue decomposed distribution 
mymix <- UnivarLebDecDistribution(acPart = wg, discretePart = Binom(4,.4),
         acWeight = 0.4)
plot(mymix)         

[Package distr version 2.0.6 Index]