Plot a Step Function
Plots a step function f(x)= sum(i; y[i] * Ind[t[i-1], t[i])(x)), i.e., a piecewise constant function of one variable. With one argument, plots the empirical cumulative distribution function.
plotStep(ti, y, cad.lag = TRUE, verticals = !cad.lag, left.points= cad.lag, right.points= FALSE, end.points= FALSE, add = FALSE, pch = par('pch'), xlab=deparse(substitute(ti)), ylab=deparse(substitute(y)), main=NULL, ...)
ti |
numeric vector = |
y |
numeric vector |
cad.lag |
logical: Draw 'cad.lag', i.e., “continue à droite, limite à gauche”. Default = TRUE. |
verticals |
logical: Draw vertical lines? Default= |
left.points |
logical: Draw left points? Default= |
right.points |
logical: Draw right points? Default= |
end.points |
logical: Draw 2 end points? Default= |
add |
logical: Add to existing plot? Default= |
pch |
plotting character for points, see |
xlab,ylab |
labels of x- and y-axis |
main |
main title; defaults to the call' if you do not want a title,
use |
... |
Any valid argument to |
invisibly: List with components t
and y
.
Calls plot(..), points(..), segments(..) appropriately and plots on current graphics device.
Martin Maechler, Seminar for Statistics, ETH Zurich, maechler@stat.math.ethz.ch, 1991 ff.
The plot
methods plot.ecdf
and
plot.stepfun
in R which are conceptually nicer.
segments(..., method = "constant")
.
##-- Draw an Empirical CDF (and see the default title ..) plotStep(rnorm(15)) plotStep(runif(25), cad.lag=FALSE) plotStep(runif(25), cad.lag=FALSE, add=TRUE, lty = 2) ui <- sort(runif(20)) plotStep(ui, ni <- cumsum(rpois(19, lambda=1.5) - 1.5), cad.lag = FALSE) plotStep(ui, ni, verticals = TRUE, right.points = TRUE) plotStep(rnorm(201), pch = '.') #- smaller points
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.