gspineplot: Spine plots and spinograms

gspineplotR Documentation

Spine plots and spinograms

Description

Spine plots are a special case of mosaic plots and can be seen as a generalization of stacked (or highlighted) bar plots. Analogously, spinograms are an extension of histograms.

Usage

gspineplot(x, ...)

## Default S3 method:
gspineplot(
  x,
  y = NULL,
  breaks = NULL,
  tol.ylab = 0.05,
  off = NULL,
  ylevels = NULL,
  col = NULL,
  main = "",
  xlab = NULL,
  ylab = NULL,
  xaxlabels = NULL,
  yaxlabels = NULL,
  xlim = NULL,
  ylim = c(0, 1),
  axes = TRUE,
  ...,
  grid = TRUE,
  col.grid = "grey90",
  col.acc = "white"
)

## S3 method for class 'formula'
gspineplot(
  formula,
  data = NULL,
  breaks = NULL,
  tol.ylab = 0.05,
  off = NULL,
  ylevels = NULL,
  col = NULL,
  main = "",
  xlab = NULL,
  ylab = NULL,
  xaxlabels = NULL,
  yaxlabels = NULL,
  xlim = NULL,
  ylim = c(0, 1),
  axes = TRUE,
  ...,
  subset = NULL,
  grid = TRUE,
  col.grid = "grey90",
  col.acc = "white"
)

Arguments

x

an object, the default method expects either a single variable (interpreted to be the explanatory variable) or a 2-way table. See details.

...

additional arguments passed to rect.

y

a "factor" interpreted to be the dependent variable

breaks

if the explanatory variable is numeric, this controls how it is discretized. breaks is passed to hist and can be a list of arguments.

tol.ylab

convenience tolerance parameter for y-axis annotation. If the distance between two labels drops under this threshold, they are plotted equidistantly.

off

vertical offset between the bars (in per cent). It is fixed to 0 for spinograms and defaults to 2 for spine plots.

ylevels

a character or numeric vector specifying in which order the levels of the dependent variable should be plotted.

col

a vector of fill colors of the same length as levels(y). The default is to call gray.colors.

main, xlab, ylab

character strings for annotation

xaxlabels, yaxlabels

character vectors for annotation of x and y axis. Default to levels(y) and levels(x), respectively for the spine plot. For xaxlabels in the spinogram, the breaks are used.

xlim, ylim

the range of x and y values with sensible defaults.

axes

logical. If FALSE all axes (including those giving level names) are suppressed.

grid

logical; if TRUE, a background grid will be drawn

col.grid

grid color

col.acc

grid accent color

formula

a "formula" of type y ~ x with a single dependent "factor" and a single explanatory variable.

data

an optional data frame.

subset

an optional vector specifying a subset of observations to be used for plotting.


raredd/plotr documentation built on Nov. 19, 2023, 4:09 a.m.