Scatter Plots

DESCRIPTION:

Creates a scatter plot on the current graphics device.

USAGE:

plot.default(x, y, type = "p", log = "") 

REQUIRED ARGUMENTS:

x,y
coordinates of points. The coordinates can be given by two vector arguments or by a single arguments x which is a times series, a two-column matrix, or a list containing components named x and y. If a single numeric x is given, time(x) is plotted on the x-axis and x on the y-axis. If a complex x is given, Re(x) is plotted on the x-axis and Im(x) on the y-axis. Missing values (NA) are allowed. Any points containing missing values will be omitted from the plot.

OPTIONAL ARGUMENTS:

type=
one of the following options: "p" points

"l" lines

"b" both

"o" both (overlaid)

"n" nothing

"s" stairsteps, first segment is horizontal

"S" stairsteps, first segment is vertical

"h" high-density lines drawn vertically from the x-axis to the coordinates of the points.

log=
values of "x", "y", or "xy" specify which axes are to be plotted on a logarithmic base 10 scale. By default, logarithmic axes are not produced.

Graphical parameters may also be supplied as arguments to this function (see ). In addition, the high-level graphics arguments described under and the arguments to may be supplied to this function.

SIDE EFFECTS:

a plot is created on the current graphics device.

DETAILS:

This is the default method for the plot function.

If there are non-positive observations in a coordinate that is plotted on a logarithmic scale, then those observations are not plotted and a warning is given. To get an axis label at the extremes, use, for example, ylim=range(pretty(y)) .

The log argument to plot sets the axes to a log base 10 scale (this differs from the log function, which is the natural logarithm).

The stairsteps options are most commonly used when x is ordered. If x is ordered and y is non-decreasing (e.g. an empirical distribution function), type = "S" stairsteps will dominate (be nowhere less than) type = "s" stairsteps.

SEE ALSO:

, , , , , , , , , , , , , , , , , , .

EXAMPLES:

plot(corn.rain, corn.yield)     # simple scatter plot 
plot(x, y, type = "l")  # connected lines 
plot(x, y, log = "xy")  # log10-log10 plot 
plot(x, y, type = "n");text(x, y)       # do not plot, then 
        # use text to label each point from 1 to n 
plot(gnp, type = "h")   # high-density plot of time-series 
plot(density(x), type = "l")    # plot of list xy