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.
plot(x, y, ...)
plot
method can be provided.x
is an appropriate structure.par
).
Many methods will accept the following arguments:
type
"p"
for points,
"l"
for lines,
"b"
for both,
"c"
for the lines part alone of "b"
,
"o"
for both ‘overplotted’,
"h"
for ‘histogram’ like (or
‘high-density’) vertical lines,
"s"
for stair steps,
"S"
for other steps, see ‘Details’ below,
"n"
for no plotting.
All other type
s give a warning or an error; using, e.g.,
type = "punkte"
being equivalent to type = "p"
for S
compatibility. Note that some methods,
e.g.\ifelse{latex}{\out{~}}{ } plot.factor
, do not accept this.
main
title
.
sub
title
.
xlab
title
.
ylab
title
.
asp
plot.window
.
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()
.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")