

plot.default {base}                          R Documentation

_T_h_e _D_e_f_a_u_l_t _S_c_a_t_t_e_r_p_l_o_t _F_u_n_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n_:

     Draw a scatter plot with ``decorations'' such as axes
     and titles in the active graphics window.

_U_s_a_g_e_:

     plot.default(x, y = NULL, type = "p",  xlim = NULL, ylim = NULL,
                  log = "", main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
                  ann = par("ann"), axes = TRUE, frame.plot = axes,
                  panel.first = NULL, panel.last = NULL,
                  col = par("fg"), bg = NA, pch = par("pch"),
                  cex = par("cex"), lty = par("lty"), lwd = par("lwd"),
                  asp = NA, ...)

_A_r_g_u_m_e_n_t_s_:

     x,y: the `x' and `y' arguments provide the x and y
          coordinates for the plot.  Any reasonable way of
          defining the coordinates is acceptable.  See the
          function `xy.coords' for details.

    type: the type of plot desired.  The following possibil-
          ities are possible; `"p"' for points, `"l"' for
          lines, `"o"' for overplotted points and lines,
          `"b"' or `c' for points joined by lines, `"s"' and
          `"S"' for step functions and `"h"' for high den-
          sity vertical lines.

    xlim: the x limits (min,max) of the plot.

    ylim: the y limits of the plot.

     log: a character string which contains `"x"' if the x
          axis is to be logarithmic, `"y"' if the y axis is
          to be logarithmic and `"xy"' or `"yx"' if both
          axes are to be logarithmic.

    main: a main title for the plot.

     sub: a sub title for the plot.

    xlab: a label for the x axis.

    ylab: a label for the y axis.

     ann: a logical value indicating whether the default
          annotation (title and x and y axis labels) should
          appear on the plot.

    axes: a logical value indicating whether axes should be
          drawn on the plot.

frame.plot: a logical indicating whether a box should be
          drawn around the plot.

panel.first: an expression to be evaluated after the plot
          axes are set up but before any plotting takes
          place.  This can be useful for drawing background
          grids or scatterplot smooths.

panel.last: an expression to be evaluated after plotting has
          taken place.

     col: The colors for lines and points.  Multiple colors
          can be specified so that each point can be given
          its own color.  If there are fewer colors than
          points they are recycled in the standard fashion.

      bg: background color of ???

     pch: a vector of plotting characters or symbols.

     cex: a numerical value giving the amount by which plot-
          ting text and symbols should be scaled relative to
          the default

     lty: the line type, see `par'.

     lwd: the line width not yet supported for postscript.

     asp: the y/x aspect ratio, see `plot.window'.

     ...: graphical parameters as in `par(...)' may also be
          passed as arguments.

_R_e_f_e_r_e_n_c_e_s_:

     Cleveland, W. S. (1985).  The Elements of Graphing
     Data.  Monterey, CA: Wadsworth.

_S_e_e _A_l_s_o_:

     `plot', `plot.window', `xy.coords'.

_E_x_a_m_p_l_e_s_:

     data(cars)
     Speed <- cars$speed
     Distance <- cars$dist
     plot(Speed, Distance, panel.first = grid(8,8),
          pch = 0, cex = 1.2, col = "blue")
     plot(Speed, Distance,
          panel.first = lines(lowess(Speed, Distance), lty = "dashed"),
          pch = 0, cex = 1.2, col = "blue")

     ##--- Log-Log Plot  with  custom axes
     lx <- seq(1,5, length=41)
     yl <- expression(e^{-frac(1,2) * {log[10](x)}^2})
     y <- exp(-.5*lx^2)
     op <- par(mfrow=c(2,1), mar=par("mar")+c(0,1,0,0))
     plot(10^lx, y, log="xy", type="l", col="purple",
          main="Log-Log plot", ylab=yl, xlab="x")
     plot(10^lx, y, log="xy", type="o", pch='.', col="forestgreen",
          main="Log-Log plot with custom axes", ylab=yl, xlab="x",
          axes = FALSE, frame.plot = TRUE)
     axis(1, at = my.at <- 10^(1:5), labels = formatC(my.at, format="fg"))
     at.y <- 10^(-5:-1)
     axis(2, at = at.y, labels = formatC(at.y, format="fg"), col.axis="red")
     par(op)

