Learn R Programming

ggfortify (version 0.4.17)

ggdistribution: Plot distribution

Description

Plot distribution

Usage

ggdistribution(
  func,
  x,
  p = NULL,
  colour = "#000000",
  linetype = NULL,
  fill = NULL,
  alpha = NULL,
  xlim = c(NA, NA),
  ylim = c(NA, NA),
  log = "",
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  asp = NULL,
  ...
)

Value

ggplot

Arguments

func

PDF or CDF function

x

Numeric vector to be passed to func

p

ggplot2::ggplot instance to plot

colour

Line colour

linetype

Line type

fill

Fill colour

alpha

Alpha

xlim

X axis limit

ylim

Y axis limit

log

log

main

main

xlab

xlab

ylab

ylab

asp

asp

...

Keywords passed to PDC/CDF func

Examples

Run this code
ggdistribution(dnorm, seq(-3, 3, 0.1), mean = 0, sd = 1)
ggdistribution(ppois, seq(0, 30), lambda = 20)

p <- ggdistribution(pchisq, 0:20, df = 7, fill = 'blue')
ggdistribution(pchisq, 0:20, p = p, df = 9, fill = 'red')

Run the code above in your browser using DataLab