distr (version 2.2.3)

plot-methods: Methods for Function plot in Package `distr'

Description

plot-methods

Usage

plot(x, y, ...)
## S3 method for class '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,
     to.draw.arg = NULL)
## S3 method for class '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,
     to.draw.arg = NULL)
## S3 method for class '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,
     to.draw.arg = NULL)
## S3 method for class '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,
     to.draw.arg = NULL)
## S3 method for class 'DistrList,missing':
plot(x, y, ...)
## S3 method for class 'CompoundDistribution,missing':
plot(x, y, ...)

Arguments

x
object of class "AffLinUnivarLebDecDistribution" or class "UnivarLebDecDistribution" or class "AbscontDistribution" or class "DiscreteDistribution" or
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. Either as in plot.default (i.e. a vector of length 2) or a vector of length 4, where the first two elements are the values for ylim in panel "d", and the last two elements are the values for <
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: do panels for density/probability function - cdf - quantile function have their own titles? or list which is filled to length 3 (resp. 8 for class UnivarLebDecDistribution) if necessary
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
to.draw.arg
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: in case of an object x of class "D
...
addtional arguments for plot --- see plot, plot.default,

Details

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] 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 "-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: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object] 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

Run this code
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)         
#
## selection of subpanels for plotting
N <- Norm()
par(mfrow=c(1,2))
plot(N, mfColRow = FALSE, to.draw.arg=c("d","q"))
plot(N, mfColRow = FALSE, to.draw.arg=c(2,3))
par(mfrow=c(1,1))

wg <- flat.mix(UnivarMixingDistribution(Unif(0,1),Unif(4,5),
               withSimplify=FALSE))
myLC <- UnivarLebDecDistribution(discretePart=Binom(3,.3), acPart = wg,
          discreteWeight=.2)
layout(matrix(c(rep(1,6),2,2,3,3,4,4,5,5,5,6,6,6), 
              nrow=3, byrow=TRUE))
plot(myLC,mfColRow = FALSE,
     to.draw.arg=c("p","d.c","p.c","q.c", "p.d","q.d"))

P <- Pois(2)
plot(as(P,"UnivarLebDecDistribution"),mfColRow = FALSE,to.draw.arg=c("d.d"))

Run the code above in your browser using DataCamp Workspace