Learn R Programming

PBSmodelling (version 2.67.266)

plotFriedEggs: Render a Pairs Plot as Fried Eggs and Beer

Description

Create a pairs plot where the lower left half comprises either fried egg contours or smoke ring contours, the upper right half comprises glasses of beer filled to the correlation point, and the diagonals show frequency histograms of the input data.

Usage

plotFriedEggs(A, eggs=TRUE, rings=TRUE, levs=c(0.01,0.1,0.5,0.75,0.95), pepper=200, replace=FALSE, jitt=c(1,1), bw=25, histclr=NULL)

Arguments

A
data frame or matrix for use in a pairs plot.
eggs
logical: if TRUE, fry eggs in the lower panels.
rings
logical: if TRUE, blow smoke rings in the lower panels.
levs
explicit contour levels expressed as quantiles.
pepper
number of samples to draw from A to pepper the plots.
replace
logical: if TRUE, sample A with replacement.
jitt
argument factor used by function base::jitter when peppering. If user supplies two numbers, the first will jitter x, the second will jitter y.
bw
argument bandwidth used by function KernSmooth::bkde2D.
histclr
user-specified colour(s) for histogram bars along the diagonal.

Details

This function comes to us from Dr. Steve Martell of the Fisheries Science Centre at UBC. Obviously many hours of contemplation with his students at the local pub have contributed to this unique rendition of a pairs plot.

See Also

plotBubbles, scalePar

KernSmooth::bkde2D, grDevices::contourLines, graphics::contour

Examples

Run this code
local(envir=.PBSmodEnv,expr={
  oldpar = par(no.readonly=TRUE)
  x=rnorm(5000,10,3); y=-x+rnorm(5000,1,4); z=x+rnorm(5000,1,3)
  A=data.frame(x=x,y=y,z=z)
  for (i in 1:3)
    switch(i,
    {plotFriedEggs(A,eggs=TRUE,rings=FALSE);
     pause("Here are the eggs...(Press Enter for next)")},
    {plotFriedEggs(A,eggs=FALSE,rings=TRUE);
     pause("Here are the rings...(Press Enter for next)")},
    {plotFriedEggs(A,eggs=FALSE,rings=FALSE);
     cat("Here is the pepper alone.\n")} )
  par(oldpar)
})

Run the code above in your browser using DataLab