plotjt: Jittered plot

plotjitR Documentation

Jittered plot

Description

Plot comparing classes, with jittered points (random noise is added over the x-acis) for avoiding overplotting.

Usage

plotjit(x, y, group = NULL, 
  jit = 1, col = NULL, alpha.f = .8,
  legend = TRUE, legend.title = NULL, ncol = 2, med = TRUE,
  ...)

Arguments

x

A vector of length n defining the class membership of the observations (x-axis).

y

A vector of length n defining the variable to plot (y-axis).

group

A vector of length n defining groups of observations to be plotted with different colors (default to NULL).

jit

Scalar defining the jittering magnitude. Default to 1.

alpha.f

Scalar modifying the opacity of the points in the graphics; typically in [0,1]. See adjustcolor.

col

A color, or a vector of colors (of length equal to the number of classes or groups), defining the color(s) of the points.

legend

Only if there are groups. Logical indicationg is a legend is drawn for groups (Default to FALSE).

legend.title

Character string indicationg a title for the legend.

ncol

Number of columns drawn in the legend box.

med

Logical. If TRUE (default), the median of each class is plotted.

...

Other arguments to pass in plot.

Value

A plot.

Examples


n <- 500
x <- c(rep("A", n), rep("B", n))
y <- c(rnorm(n), rnorm(n, mean = 5, sd = 3))
group <- sample(1:2, size = 2 * n, replace = TRUE)

plotjit(x, y, pch = 16, jit = .5, alpha.f = .5)

plotjit(x, y, pch = 16, jit = .5, alpha.f = .5,
  group = group)



mlesnoff/rnirs documentation built on April 24, 2023, 4:17 a.m.