scatterplot               package:car               R Documentation

_S_c_a_t_t_e_r_p_l_o_t_s _w_i_t_h _B_o_x_p_l_o_t_s

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

     Makes fancy scatterplots, with boxplots in the margins, a lowess
     smooth, and a regression line; 'sp' is an abbreviation for
     'scatterplot'.

_U_s_a_g_e:

     scatterplot(x, ...)

     ## S3 method for class 'formula':
     scatterplot(formula, data, xlab, ylab, legend.title, subset, labels=FALSE, ...)

     ## Default S3 method:
     scatterplot(x, y, smooth=TRUE, span=0.5, reg.line=lm, 
       boxplots="xy", xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), 
       las=par('las'), lwd=1, labels=FALSE, log="", jitter=list(), xlim=NULL, ylim=NULL,
       cex=par("cex"), cex.axis=par("cex.axis"), cex.lab=par("cex.lab"), 
       cex.main=par("cex.main"), cex.sub=par("cex.sub"),
       groups=FALSE, by.groups=!(groups[1]==FALSE), legend.title=deparse(substitute(groups)),
       ellipse=FALSE, levels=c(.5, .9), robust=FALSE, 
       col=palette(), pch=1:n.groups, legend.plot=length(levels(groups)) > 1, 
       reset.par=TRUE, ...)
       
     sp(...)

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

 formula: ``model'' formula, of the form 'y ~ x' or  (to plot by
          groups) 'y ~ x | z', where 'z' evaluates to a factor  or
          other variable dividing the data into groups.

    data: data frame within which to evaluate the formula.

  subset: expression defining a subset of observations.

       x: vector of horizontal coordinates.

       y: vector of verical coordinates.

  smooth: if 'TRUE' a lowess nonparametric regression line is drawn on
          the plot.

    span: span for the lowess smooth.

reg.line: function to draw a regression line on the plot or 'FALSE' not
          to plot a regression line.

boxplots: if '"x"' a boxplot for 'x' is drawn above the plot; if '"y"'
          a boxplot for 'y' is drawn to the right of the plot; if
          '"xy"' both boxplots are drawn.

    xlab: label for horizontal axis.

    ylab: label for vertical axis.

     las: if '0', ticks labels are drawn parallel to the axis; set to
          '1' for horizontal labels (see 'par').

     lwd: width of plotted lines.

  labels: if not 'FALSE' a vector of point labels, to be used
          interactively to identify points on the plot.

     log: same as the 'log' argument to 'plot', to produce log axes.

  jitter: a list with elements 'x' or 'y' or both, specifying jitter
          factors for the horizontal and vertical coordinates of the
          points in the scatterplot. The  'jitter' function is used to
          randomly perturb the points; specifying a factor of '1'
          produces the default jitter. Fitted lines are unaffected by
          the jitter.

    xlim: the x limits (min,max) of the plot; if 'NULL', determined
          from the data.

    ylim: the y limits (min,max) of the plot; if 'NULL', determined
          from the data.

  groups: a factor or other variable dividing the data into groups;
          groups are plotted with different colors and plotting
          characters.

by.groups: if 'TRUE', regression lines are fit by groups.

legend.title: title for legend box; defaults to the name of the groups
          variable.

 ellipse: if 'TRUE' data-concentration ellipses are plotted.

  levels: level or levels at which concentration ellipses are plotted;
          the default is 'c(.5, .9)'.

  robust: if 'TRUE' use the 'cov.trob' function in the 'MASS' package
          to calculate the center and covariance matrix for the data
          ellipse.

     col: colors for points and lines; the default is the current color
          palette, starting at the _second_ entry (see 'palette' and
          'par').

     pch: plotting characters for points; default is the plotting
          characters in order (see 'par').

cex, cex.axis, cex.lab, cex.main, cex.sub: set sizes of various
          graphical elements;  (see 'par').

legend.plot: if 'TRUE' then a legend for the groups is plotted in the
          upper margin.

reset.par: if 'TRUE' then plotting parameters are reset to their
          previous values when 'scatterplot' exits; if 'FALSE' then the
          'mar' and 'mfcol' parameters are altered for the current
          plotting device. Set to 'FALSE' if you want to add graphical
          elements (such as lines) to the plot.

     ...: other arguments passed to 'plot'.

_V_a_l_u_e:

     'NULL'. This function is used for its side effect: producing a
     plot.

_A_u_t_h_o_r(_s):

     John Fox jfox@mcmaster.ca

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

     'graphics', 'boxplot', 'jitter'  'scatterplot.matrix',
     'data.ellipse', 'par', 'cov.trob'.

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

     scatterplot(prestige ~ income|type, data=Prestige, span=1)

     scatterplot(vocabulary ~ education, jitter=list(x=1, y=1), data=Vocab)

       ## Not run: 
     scatterplot(infant.mortality ~ gdp, labels=row.names(UN), data=UN)

     scatterplot(infant.mortality ~ gdp, log="xy", labels=row.names(UN), data=UN)
       ## End(Not run)

