panel.quadrants: Draw quadrants and quadrant statistics in lattice plots

panel.quadrantsR Documentation

Draw quadrants and quadrant statistics in lattice plots

Description

This panel function allows to draw custom quadrants and display additional quadrant statistics as often used in biomedical sciences. Grouping is ignored.

Usage

panel.quadrants(
  x,
  y,
  h = NULL,
  v = NULL,
  labels = "percent",
  col = grey(0.5),
  margin = 0.1,
  lwd = trellis.par.get()$superpose.polygon$lwd[1],
  na.rm = FALSE,
  ...
)

Arguments

x, y

(numeric) variables to be plotted

h, v

(numeric) position of the horizontal or vertical threshold for dividing the data into quadarants. Defaults to the median.

labels

(character) One of 'percent', 'events', or 'none'. Controls what type of summary is plottted per quadrant

col, lwd

graphical parameters for lines and labels

margin

(numeric) margin of labels to the plot edges in Normalised Parent Coordinates, default is 0.1

na.rm

(logical) Should NA or Inf values be removed automatically? Default is FAlSE

...

other arguments passed to the function

Examples

library(lattice)
data(mtcars)

# Default behavior for quadrants is to split x and y data
# at the respective median, and plot percentage of points 
# per quandrant
xyplot(mpg ~ 1/wt | factor(vs), mtcars,
  groups = carb, pch = 19, cex = 1,
  panel = function(x, y, ...) {
    panel.xyplot(x, y, ...)
    panel.quadrants(x, y, ...)
  }
)


m-jahn/lattice-tools documentation built on Dec. 3, 2023, 11:14 p.m.