distr (version 1.9)

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

Description

plot-methods

Usage

plot(x,y, ...)
## S3 method for class 'AbscontDistribution':
plot(x, y = NULL, xlim = NULL, ylim = NULL, 
     width = 16, height = 9, withSweave = FALSE, 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)
## S3 method for class 'DiscreteDistribution':
plot(x, y = NULL, xlim = NULL, ylim = NULL, 
     width = 16, height = 9, withSweave = FALSE, 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)
## S3 method for class 'DistrList':
plot(x, y = NULL, ...)

Arguments

x
object of class "AbscontDistribution" or class "DiscreteDistribution" or class "DistrList": (list of) distribution(s) to be plotted
y
not used; for compatibility with generic plot
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 argu
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
...
addtional arguments for plot --- see plot, plot.default,

code

cex

Details

[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:

  • "%C"
{class of argument x} "%P"{parameters of x in form of a comma-separated list of 's coerced to character} "%Q"{parameters of x in form of a comma-separated list of 's coerced to character and in parenthesis --- unless empty; then ""} "%N"{parameters of x in form of a comma-separated list = coerced to character} "%A"{deparsed argument x} "%D"{time/date-string when the plot was generated}

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")

Run the code above in your browser using DataCamp Workspace