\Header{plot.stepfun}{Plot Step Functions}
\keyword{hplot}{plot.stepfun}
\begin{Usage}
\begin{verbatim}
plot.stepfun(Fn, x, xlim, xlab = "x", ylab = "f(x)", main = NULL,
     add = FALSE, verticals = TRUE, do.points = TRUE,
     pch = par("pch"), col.points=par("col"), cex.points=par("cex"),
     col.hor = par("col"), col.vert= par("col"), ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{Fn}] an \R\ object inheriting from \texttt{"stepfun"}.
\item[\texttt{x}] numeric vector of abscissa values at which to evaluate
\texttt{Fn}.  Defaults to \texttt{\Link{knots}(Fn)} restricted to \texttt{xlim}.
\item[\texttt{xlim}] numeric(2); range of \texttt{x} values to use.
\item[\texttt{add}] logical; if \texttt{TRUE} only \emph{add} to an existing plot.
\item[\texttt{verticals}] logical;  if \texttt{TRUE}, draw vertical lines at steps.
\item[\texttt{do.points}] logical;  if \texttt{true}, also draw points at the
(\texttt{xlim} restricted) knot locations.
\item[\texttt{pch}] character; point character if \texttt{do.points}.
\item[\texttt{col.points}] character or integer code; color of points if \texttt{do.points}.
\item[\texttt{cex.points}] numeric; character expansion factor if \texttt{do.points}.
\item[\texttt{col.hor}] color of horizontal lines.
\item[\texttt{col.vert}] color of vertical lines.
\item[\texttt{xlab,ylab}] labels of x and y axis.
\item[\texttt{main}] main title.
\item[\texttt{...}] further arguments of \texttt{\Link{plot}(.)}, or if\texttt{(add)}
\texttt{\Link{segments}(.)}.
\end{ldescription}
\end{Arguments}
\begin{Description}
Method of the generic \texttt{\Link{plot}} for \texttt{\Link{stepfun}}
objects and utility for plotting piecewise constant functions.\end{Description}
\begin{Value}
A list with two components
\begin{ldescription}
\item[\texttt{t}] abscissa (x) values, including the two outermost ones.
\item[\texttt{y}] y values `in between' the \texttt{t[]}.
\end{ldescription}
\end{Value}
\begin{Author}
Martin Maechler \email{<maechler@stat.math.ethz.ch>}, 1990,
1993; ported to \R, 1997.\end{Author}
\begin{SeeAlso}
\texttt{\Link{ecdf}} for empirical distribution functions as
special step functions,
\texttt{\Link{approxfun}} and \texttt{\Link{splinefun}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
y0 <- c(1,2,4,3)
sfun0  <- stepfun(1:3, y0, f = 0)
sfun.2 <- stepfun(1:3, y0, f = .2)
sfun1  <- stepfun(1:3, y0, f = 1)

tt <- seq(0,3, by=0.1)
op <- par(mfrow=c(2,2))
plot(sfun0); plot(sfun0, x=tt, add=T, col.h="bisque")
plot(sfun.2);plot(sfun.2,x=tt, add=T, col.h="orange")
plot(sfun1); plot(sfun1, x=tt, add=T, col.h="coral")
##-- This is  revealing :
plot(sfun0, verticals= FALSE,
     main = "stepfun(x, y0, f=f)  for f = 0, .2, 1")
for(i in 1:3)
  plot(list(sfun0,sfun.2,sfun1)[[i]], add=TRUE, col.h=i, col.v=i)
legend(2.5, 1.9, paste("f =", c(0,0.2,1)), col=1:3, lty=1, y.inter=1); par(op)

##-- this works too (automatic call to  ecdf(.)):
plot.stepfun(rt(50, df=3), col.vert = "gray20")
\end{ExampleCode}
\end{Examples}

