plot.VectorDistribution: Plotting Distribution Functions for a VectorDistribution

View source: R/plot_vectordistribution.R

plot.VectorDistributionR Documentation

Plotting Distribution Functions for a VectorDistribution

Description

Helper function to more easily plot distributions inside a VectorDistribution.

Usage

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

Arguments

x

VectorDistribution.

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

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

## End(Not run)

distr6 documentation built on March 28, 2022, 1:05 a.m.