Learn R Programming

distionary (version 0.1.0)

plot.dst: Plot a Distribution

Description

Plot a distribution's representation.

Usage

# S3 method for dst
plot(
  x,
  what = c("density", "pmf", "cdf", "survival", "quantile", "hazard", "chf"),
  ...
)

Value

This function is run for its graphics byproduct, and therefore returns the original distribution, invisibly.

Arguments

x

Distribution object

what

Name of the representation to plot.

...

Other arguments to pass to the graphics::curve function, or graphics::plot in the case of the PMF.

Examples

Run this code
d <- dst_norm(0, 1)
plot(d, from = -4, to = 4)
plot(d, "cdf", n = 1000)
plot(d, "survival")
plot(d, "quantile")
plot(d, "hazard")
plot(d, "chf")

p <- dst_pois(4)
plot(p)

Run the code above in your browser using DataLab