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

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.

Note

If eggs=TRUE and rings=FALSE, fried eggs are served.
If eggs=FALSE and rings=TRUE, smoke rings are blown.
If eggs=TRUE and rings=TRUE, only fried eggs are served.
If eggs=FALSE and rings=FALSE, only pepper is sprinkled.

Author(s)

Steve Martell, International Pacific Halibut Commission, Seattle WA

See Also

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

Examples

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)
})

PBSmodelling

GUI Tools Made Easy: Interact with Models and Explore Data

v2.68.8
GPL (>= 2)
Authors
Jon T. Schnute [aut], Alex Couture-Beil [aut], Rowan Haigh [aut, cre], Nicholas Boers [ctb], Anisa Egeli [ctb], A. R. Kronlund [ctb], Steve Martell [ctb], Norm Olsen [ctb]
Initial release
2019-03-12

We don't support your browser anymore

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