panels.diag: More univariate panel plots

panels.diagR Documentation

More univariate panel plots

Description

Several panel plots that can be used with pairs().

Usage

panel_boxplot(x, col = par("col"), box.col = "cornsilk", ...)

panel.boxplot(x, col = par("col"), box.col = "cornsilk", ...)

panel_density(
  x,
  adjust = 1,
  rug = TRUE,
  col = par("col"),
  lwd = par("lwd"),
  line.col = col,
  line.lwd = lwd,
  ...
)

panel.density(
  x,
  adjust = 1,
  rug = TRUE,
  col = par("col"),
  lwd = par("lwd"),
  line.col = col,
  line.lwd = lwd,
  ...
)

panel_hist(
  x,
  breaks = "Sturges",
  hist.col = "cornsilk",
  hist.border = NULL,
  hist.density = NULL,
  hist.angle = 45,
  ...
)

panel.hist(
  x,
  breaks = "Sturges",
  hist.col = "cornsilk",
  hist.border = NULL,
  hist.density = NULL,
  hist.angle = 45,
  ...
)

panel_qqnorm(
  x,
  pch = par("pch"),
  col = par("col"),
  bg = par("bg"),
  cex = par("cex"),
  lwd = par("lwd"),
  qq.pch = pch,
  qq.col = col,
  qq.bg = bg,
  qq.cex = cex,
  qqline.col = qq.col,
  qqline.lwd = lwd,
  ...
)

panel.qqnorm(
  x,
  pch = par("pch"),
  col = par("col"),
  bg = par("bg"),
  cex = par("cex"),
  lwd = par("lwd"),
  qq.pch = pch,
  qq.col = col,
  qq.bg = bg,
  qq.cex = cex,
  qqline.col = qq.col,
  qqline.lwd = lwd,
  ...
)

Arguments

x

A numeric vector.

col

The color of the points.

box.col

The filling color of the boxplots.

...

Further arguments to plot functions, or functions that construct items, like density(), depending on the context.

adjust

The bandwidth adjustment factor, see density().

rug

Do we add a rug representation (1-d plot) of the points too?

lwd

The line width.

line.col

The color of the line.

line.lwd

The width of the line.

breaks

The number of breaks, the name of a break algorithm, a vector of breakpoints, or any other acceptable value for breaks argument of hist().

hist.col

The filling color for the histograms.

hist.border

The border color for the histograms.

hist.density

The density for filling lines in the histograms.

hist.angle

The angle for filling lines in the histograms.

pch

The symbol used for the points.

bg

The background color for symbol used for the points.

cex

The expansion factor used for the points.

qq.pch

The symbol used to plot points in the QQ-plots.

qq.col

The color of the symbol used to plot points in the QQ-plots.

qq.bg

The background color of the symbol used to plot points in the QQ-plots.

qq.cex

The expansion factor for points in the QQ-plots.

qqline.col

The color for the QQ-plot lines.

qqline.lwd

The width for the QQ-plot lines.

Details

Panel functions panel_boxplot(), panel_density(), panel_hist() and panel_qqnorm() should be used only to plot univariate data on the diagonals of pairs() plots (or scatterplot matrix).

Value

These functions return nothing and are used for their side effect of plotting in panels of composite plots.

Author(s)

Philippe Grosjean phgrosjean@sciviews.org, but code inspired from spm() in package car.

See Also

pairs(), boxplot(), hist(), density(), qqnorm()

Examples

# Example of scatterplot matrices with custom plots on the diagonal

# Boxplots
pairs(trees, panel = panel_smooth, diag.panel = panel_boxplot)
pairs(trees, diag.panel = panel_boxplot, box.col = "gray")

# Densities
pairs(trees, panel = panel_smooth, diag.panel = panel_density)
pairs(trees, diag.panel = panel_density, line.col = "red", adjust = 0.5)

# Histograms
pairs(trees, panel = panel_smooth, diag.panel = panel_hist)
pairs(trees, diag.panel = panel_hist, hist.col = "gray", breaks = "Scott")

# QQ-plots against Normal theoretical distribution
pairs(trees, panel = panel_smooth, diag.panel = panel_qqnorm)
pairs(trees, diag.panel = panel_qqnorm, qqline.col = 2, qq.cex = .5, qq.pch = 3)

SciViews/SciViews documentation built on Sept. 16, 2023, 10:26 p.m.