na.points: na.points

View source: R/plot_extra.R

na.pointsR Documentation

na.points

Description

Add 1-D scatter plot to plot margins for missing values.

Usage

na.points(
  x = NULL,
  y = NULL,
  xat = NULL,
  yat = NULL,
  label = "NA",
  args.beeswarm = list(),
  ...
)

Arguments

x, y

vectors of data to be plotted; if only one is given, all points will be plotted on the corresponding axis; if both are given, only x values where y is NA are plotted and vice versa

xat, yat

the x- and y-axis positions for points

label

axis label for points; use FALSE or '' to omit

args.beeswarm

a named list of additional arguments passed to beeswarm such as corral or corralWidth

...

additional arguments passed to tplot or further to par such as col, cex, or pch

Examples

op <- par(mar = c(5, 5, 5, 5))
plot(mpg ~ wt, mtcars)
na.points(y = mtcars$mpg, col = 'red')
na.points(x = mtcars$wt, pch = 16, cex = 1.5, col = 'blue')

plot(mpg ~ wt, mtcars, bty = 'l')
na.points(x = mtcars$wt, yat = par('usr')[4], label = 'Missing',
          args.beeswarm = list(corral = 'wrap', corralWidth = 1.5))

plot(mpg ~ wt, mtcars, col = rep(1:2, each = 10))
na.points(replace(mtcars$wt, 1:10, NA), replace(mtcars$mpg, 11:20, NA), col = 2)
par(op)


raredd/rawr documentation built on April 29, 2024, 10:29 a.m.