| 27442 |
ripley |
1 |
\name{plot}
|
|
|
2 |
\title{Generic X-Y Plotting}
|
|
|
3 |
\alias{plot}
|
|
|
4 |
\usage{
|
|
|
5 |
plot(x, y, \dots)
|
|
|
6 |
}
|
|
|
7 |
\arguments{
|
|
|
8 |
\item{x}{the coordinates of points in the plot. Alternatively, a
|
|
|
9 |
single plotting structure, function or \emph{any \R object with a
|
|
|
10 |
\code{plot} method} can be provided.}
|
|
|
11 |
\item{y}{the y coordinates of points in the plot, \emph{optional}
|
|
|
12 |
if \code{x} is an appropriate structure.}
|
|
|
13 |
\item{\dots}{graphical parameters can be given as arguments to
|
|
|
14 |
\code{plot}. Many methods will also accept the following arguments:
|
| 27653 |
maechler |
15 |
|
| 27442 |
ripley |
16 |
\item{type}{what type of plot should be drawn. Possible types are
|
|
|
17 |
\itemize{
|
|
|
18 |
\item \code{"p"} for \bold{p}oints,
|
|
|
19 |
\item \code{"l"} for \bold{l}ines,
|
|
|
20 |
\item \code{"b"} for \bold{b}oth,
|
|
|
21 |
\item \code{"c"} for the lines part alone of \code{"b"},
|
|
|
22 |
\item \code{"o"} for both \dQuote{\bold{o}verplotted},
|
|
|
23 |
\item \code{"h"} for \dQuote{\bold{h}istogram} like (or
|
|
|
24 |
\dQuote{high-density}) vertical lines,
|
|
|
25 |
\item \code{"s"} for stair \bold{s}teps,
|
|
|
26 |
\item \code{"S"} for other \bold{s}teps, see \emph{Details} below,
|
|
|
27 |
\item \code{"n"} for no plotting.
|
|
|
28 |
}
|
|
|
29 |
All other \code{type}s give a warning or an error; using, e.g.,
|
|
|
30 |
\code{type = "punkte"} being equivalent to \code{type = "p"} for S
|
|
|
31 |
compatibility.
|
|
|
32 |
}
|
|
|
33 |
\item{main}{an overall title for the plot: see \code{\link{title}}.}
|
|
|
34 |
\item{sub}{a sub title for the plot: see \code{\link{title}}.}
|
|
|
35 |
\item{xlab}{a title for the x axis: see \code{\link{title}}.}
|
|
|
36 |
\item{ylab}{a title for the y axis: see \code{\link{title}}.}
|
|
|
37 |
}
|
|
|
38 |
}
|
|
|
39 |
\description{
|
|
|
40 |
Generic function for plotting of \R objects. For more details about
|
|
|
41 |
the graphical parameter arguments, see \code{\link{par}}.
|
|
|
42 |
}
|
|
|
43 |
\details{
|
|
|
44 |
For simple scatter plots, \code{\link{plot.default}} will be used.
|
|
|
45 |
However, there are \code{plot} methods for many \R objects,
|
|
|
46 |
including \code{\link{function}}s, \code{\link{data.frame}}s,
|
| 27447 |
ripley |
47 |
\code{\link[stats]{density}} objects, etc. Use \code{methods(plot)} and
|
| 27442 |
ripley |
48 |
the documentation for these.
|
|
|
49 |
|
|
|
50 |
The two step types differ in their x-y preference: Going from
|
|
|
51 |
\eqn{(x1,y1)} to \eqn{(x2,y2)} with \eqn{x1 < x2}, \code{type = "s"}
|
|
|
52 |
moves first horizontal, then vertical, whereas \code{type = "S"} moves
|
|
|
53 |
the other way around.
|
|
|
54 |
}
|
|
|
55 |
\seealso{
|
|
|
56 |
\code{\link{plot.default}}, \code{\link{plot.formula}} and other
|
|
|
57 |
methods; \code{\link{points}}, \code{\link{lines}}, \code{\link{par}}.
|
|
|
58 |
}
|
|
|
59 |
\examples{
|
|
|
60 |
data(cars)
|
|
|
61 |
plot(cars)
|
|
|
62 |
lines(lowess(cars))
|
|
|
63 |
|
|
|
64 |
plot(sin, -pi, 2*pi)
|
|
|
65 |
|
|
|
66 |
## Discrete Distribution Plot:
|
|
|
67 |
plot(table(rpois(100,5)), type = "h", col = "red", lwd=10,
|
|
|
68 |
main="rpois(100,lambda=5)")
|
|
|
69 |
|
| 27653 |
maechler |
70 |
## Simple quantiles/ECDF, see ecdf() {library(stats)} for a better one:
|
| 27442 |
ripley |
71 |
plot(x <- sort(rnorm(47)), type = "s", main = "plot(x, type = \"s\")")
|
|
|
72 |
points(x, cex = .5, col = "dark red")
|
|
|
73 |
}
|
|
|
74 |
\keyword{hplot}
|