Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

scatter.with.hist

Scatterplot with histograms


Description

Draws a scatterplot of the data, and histogram in the margins. A trend line can be added, if desired.

Usage

scatter.with.hist(x, y,
  hist.col = gray(0.95),
  trend.line = "lm",
   ...)

Arguments

x

numeric predictor

y

numeric response variables

hist.col

color for histogram

trend.line

Draw a trend line using lm, supsmu or lowess. Use NULL for none.

...

Passed to plot command for scatterplot

Value

Draws the graphic. No return value.

Author(s)

John Verzani

References

This example comes from the help page for layout.

See Also

Examples

data(emissions)
attach(emissions)
scatter.with.hist(perCapita,CO2)

UsingR

Data Sets, Etc. for the Text "Using R for Introductory Statistics", Second Edition

v2.0-6
GPL (>= 2)
Authors
John Verzani <verzani@math.csi.cuny.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.