R/lines.R
lines.Distribution.Rd
One of six plots can be selected to be superimposed in the plotting window, including: pdf, cdf, quantile, survival, hazard and cumulative hazard.
# S3 method for class 'Distribution'
lines(x, fun, npoints = 3000, ...)
Unlike the plot.Distribution
function, no internal checks are performed
to ensure that the added plot makes sense in the context of the current plotting window.
Therefore this function assumes that the current plot is of the same value support, see examples.
plot.Distribution
for plotting a distr6
object.
plot(Normal$new(mean = 2), "pdf")
lines(Normal$new(mean = 3), "pdf", col = "red", lwd = 2)
if (FALSE) { # \dontrun{
# The code below gives examples of how not to use this function.
# Different value supports
plot(Binomial$new(), "cdf")
lines(Normal$new(), "cdf")
# Different functions
plot(Binomial$new(), "pdf")
lines(Binomial$new(), "cdf")
# Too many functions
plot(Binomial$new(), c("pdf", "cdf"))
lines(Binomial$new(), "cdf")
} # }