Generic function for plotting of R objects. For more details about
the graphical parameter arguments, see par
.
For simple scatter plots, plot.default
will be used.
However, there are plot
methods for many R objects,
including function
s, data.frame
s,
density
objects, etc. Use methods(plot)
and
the documentation for these.
1 
x 
the coordinates of points in the plot. Alternatively, a
single plotting structure, function or any R object with a

y 
the y coordinates of points in the plot, optional
if 
... 
Arguments to be passed to methods, such as
graphical parameters (see

The two step types differ in their xy preference: Going from
(x1,y1) to (x2,y2) with x1 < x2, type = "s"
moves first horizontal, then vertical, whereas type = "S"
moves
the other way around.
plot.default
, plot.formula
and other
methods; points
, lines
, par
.
For thousands of points, consider using smoothScatter()
instead of plot()
.
For XYZ plotting see contour
, persp
and
image
.
1 2 3 4 5 6 7 8 9 10 11 12 13  require(stats) # for lowess, rpois, rnorm
plot(cars)
lines(lowess(cars))
plot(sin, pi, 2*pi) # see ?plot.function
## Discrete Distribution Plot:
plot(table(rpois(100, 5)), type = "h", col = "red", lwd = 10,
main = "rpois(100, lambda = 5)")
## Simple quantiles/ECDF, see ecdf() {library(stats)} for a better one:
plot(x < sort(rnorm(47)), type = "s", main = "plot(x, type = \"s\")")
points(x, cex = .5, col = "dark red")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.