Learn R Programming

distr6 (version 1.5.6)

plot.VectorDistribution: Plotting Distribution Functions for a VectorDistribution

Description

Helper function to more easily plot distributions inside a VectorDistribution.

Usage

# S3 method for VectorDistribution
plot(x, fun = "pdf", topn, ind, cols, ...)

Arguments

fun

function to plot, one of: "pdf","cdf","quantile", "survival", "hazard", "cumhazard".

topn

integer. First n distributions in the VectorDistribution to plot.

ind

integer. Indices of the distributions in the VectorDistribution to plot. If given then topn is ignored.

cols

character. Vector of colours for plotting the curves. If missing 1:9 are used.

...

Other parameters passed to plot.Distribution.

Details

If topn and ind are both missing then all distributions are plotted if there are 10 or less in the vector, otherwise the function will error.

See Also

plot.Distribution

Examples

Run this code
# NOT RUN {
# Plot pdf of Normal distribution
vd <- VectorDistribution$new(list(Normal$new(), Normal$new(mean = 2)))
plot(vd)
plot(vd, fun = "surv")
plot(vd, fun = "quantile", ylim = c(-4, 4), col = c("blue", "purple"))
# }

Run the code above in your browser using DataLab