Last data update: 2014.03.03

R: More univariate panel plots
panels.diagR Documentation

More univariate panel plots

Description

Several panel plots that can be used with function pairs.

Usage

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.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, ...)

Arguments

x

a numeric vector.

col

the color of the points.

box.col

the filling color of the boxplots.

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.

...

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

Details

Panel functions panel.boxplot(), panel.density(), panel.hist() and panel.qqnorm() should be used only to plot univariate data on the diagonals of pair 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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(SciViews)
Loading required package: MASS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SciViews/panels.diag.Rd_%03d_medium.png", width=480, height=480)
> ### Name: panels.diag
> ### Title: More univariate panel plots
> ### Aliases: panel.boxplot panel.density panel.hist panel.qqnorm
> ### Keywords: aplot
> 
> ### ** 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")
There were 39 warnings (use warnings() to see them)
> ## Densities
> pairs(trees, panel = panel.smooth, diag.panel = panel.density)
> pairs(trees, diag.panel = panel.density, line.col = "red", adjust = 0.5)
There were 50 or more warnings (use warnings() to see the first 50)
> ## Histograms
> pairs(trees, panel = panel.smooth, diag.panel = panel.hist)
> pairs(trees, diag.panel = panel.hist, hist.col = "gray", breaks = "Scott")
There were 50 or more warnings (use warnings() to see the first 50)
> ## 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)
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>