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