indexplot: Index Plots

View source: R/plots.R

indexplotR Documentation

Index Plots

Description

Index Plots

Usage

indexplot(
  x,
  groups,
  labels = seq_along(x),
  id.method = "y",
  type = "h",
  id.n = 0,
  ylab,
  legend = "topright",
  title,
  col = palette(),
  ...
)

Arguments

x

a numeric variable, a matrix whose columns are numeric variables, or a numeric data frame; if x is a matrix or data frame, plots vertically aligned index plots for the columns.

groups

an optional grouping variable, typically a factor (or character or logical variable).

labels

point labels; if x is a data frame, defaults to the row names of x, otherwise to the case index.

id.method

method for identifying points; see showLabels.

type

to be passed to plot.

id.n

number of points to identify; see showLabels.

ylab

label for vertical axis; if missing, will be constructed from x; for a data frame, defaults to the column names.

legend

see legend) giving location of the legend if groups are specified; if legend=FALSE, the legend is suppressed.

title

title for the legend; may normally be omitted.

col

vector of colors for the groups.

...

to be passed to plot.

Details

Index plots with point identification.

Value

Returns labelled indices of identified points or (invisibly) NULL if no points are identified or if there are multiple variables with some missing data.

Author(s)

John Fox

See Also

showLabels, plot.default

Examples

with(Prestige, indexplot(income, id.n=2, labels=rownames(Prestige)))
with(Prestige, indexplot(Prestige[, c("income", "education", "prestige")],
               groups = Prestige$type, id.n=2))


RcmdrMisc documentation built on Jan. 8, 2026, 9:06 a.m.