Learn R Programming

qrmtools (version 0.0-14)

stepfun_plot: Plot of Step Functions and Empirical Distribution Functions

Description

Plotting step functions and empirical distribution functions.

Usage

stepfun_plot(x, yleft, do.points = NA, log = "",
             xlim = NULL, ylim = NULL, col = NULL, main = "",
             xlab = "x", ylab = "Function value at x", ...)
edf_plot(x, yleft = 0, do.points = NA, log = "", xlim = NULL, ylim = NULL,
         col = NULL, main = "", xlab = "x", ylab = "Distribution function at x", ...)

Arguments

x

stepfun_plot()

2-column matrix (with x- and y-values) or list of such; if a list, each element corresponds to one function to plot.

edf_plot()

numeric vector or a list of such; if a list, each element corresponds to one empirical distribution function.

yleft

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

do.points

logical (vector) indicating whether points are to be plotted (defaults to TRUE if and only if there are less than or equal to 100 data points); see ?plot.stepfun.

log

character indicating whether a logarithmic x-axis is used.

xlim

x-axis limits.

ylim

y-axis limits.

col

(vector of) color(s).

main

title.

xlab

x-axis label.

ylab

y-axis label.

additional arguments passed to the underlying plot.stepfun().

Value

Nothing (plot by side-effect).

Examples

Run this code
# NOT RUN {
x <- c(5, 2, 4, 2, 3, 2, 2, 2, 1, 2) # example data
edf_plot(x) # the default
edf_plot(x, verticals = FALSE) # the 'mathematical' version
edf_plot(x, do.points = FALSE) # good for many sample points
edf_plot(x, log = "x") # logarithmic; cannot show flat part before first jump
edf_plot(list(x, x+2), col = c("black", "royalblue3")) # plots both empirical distributions
edf_plot(list(x, x[1:4]+2), log = "x", col = c("black", "royalblue3"))
# }

Run the code above in your browser using DataLab