R/panel.hist.R

#' Modification of pairs plots to show histograms and correlation coefficients
#' This is not my code, but I can't find it in a package
#'
#' \code{pairs(DF, upper.panel = panel.points,
#'             lower.panel = panel.cor, diag.panel = panel.hist)}
#'

panel.hist <- function(x, ...)
{
  usr <- par("usr"); on.exit(par(usr))
  par(usr = c(usr[1:2], 0, 1.5) )
  h <- hist(x, plot = FALSE)
  breaks <- h$breaks; nB <- length(breaks)
  y <- h$counts; y <- y/max(y)
  rect(breaks[-nB], 0, breaks[-1], y, col="gold", ...)
}
helophilus/ColsTools documentation built on May 30, 2019, 4:03 p.m.