step_plot: Plot of Step Functions, Empirical Distribution and Quantile...

View source: R/graphics.R

step_plotR Documentation

Plot of Step Functions, Empirical Distribution and Quantile Functions

Description

Plotting step functions, empirical distribution functions and empirical quantile functions.

Usage

step_plot(x, y, y0 = NA, x0 = NA, x1 = NA, method = c("edf", "eqf"), log = "",
          verticals = NA, do.points = NA, add = FALSE,
          col = par("col"), main = "", xlab = "x", ylab = "Function value at x",
          plot.args = NULL, segments.args = NULL, points.args = NULL)
edf_plot(x, y0 = 0, x0 = NA, x1 = NA, log = "",
         verticals = NA, do.points = NA, col = par("col"),
         main = "", xlab = "x", ylab = "Distribution function at x", ...)
eqf_plot(x, y0 = NA, x0 = 0, x1 = 1, log = "",
         verticals = NA, do.points = NA, col = par("col"),
         main = "", xlab = "x", ylab = "Quantile function at x", ...)

Arguments

x
step_plot():

numeric vector of x-values.

edf_plot():

numeric vector or a list of numeric vectors; if a list, each element corresponds to the x-values of an empirical distribution function.

eqf_plot():

similar to edf_plot().

y

y-values corresponding to x.

y0

y-value of the graph extending to the left of the first x-value.

x0

smallest x-value.

x1

largest x-value.

method

character string indicating the type of method to be used ("edf" for empricial distribution function types of plots and "eqf" for empirical quantile function types).

log

character indicating whether a logarithmic x-axis is used.

verticals

logical indicating whether to plot vertical lines (defaults to TRUE if and only if there are 100 or more data points).

do.points

logical (vector) indicating whether points are to be plotted (defaults to TRUE if and only if there are less than 100 data points).

add

logical indicating whether the current plot is added to the last one.

col

color (for edf_plot() this can be a vector).

main

title.

xlab

x-axis label.

ylab

y-axis label.

plot.args

list of additional arguments passed to the underlying plot().

segments.args

list of additional arguments passed to the underlying segments().

points.args

list of additional arguments passed to the underlying points().

...

additional arguments passed to the underlying step_plot().

Value

Nothing (plot by side-effect).

Author(s)

Marius Hofert

Examples

x <- c(5, 2, 4, 2, 3, 2, 2, 2, 1, 2) # example data
edf_plot(x) # empirical distribution function (edf)
edf_plot(x, log = "x")
edf_plot(x, verticals = TRUE)
edf_plot(x, do.points = FALSE)
cols <- c("black", "royalblue3")
edf_plot(list(x, x+2), col = cols) # edf with shifted edf
edf_plot(list(x, x+2), col = cols, x0 = 0.5, x1 = 7.5)
edf_plot(list(x, x+2), col = cols, x0 = 0.5, x1 = 7.5, verticals = TRUE)
eqf_plot(x) # empirical quantile function
eqf_plot(x, verticals = TRUE)

qrmtools documentation built on May 29, 2024, 9:35 a.m.