plotsimplex: Produces a simplex plot of probability vectors.

plotsimplexR Documentation

Produces a simplex plot of probability vectors.

Description

A K dimensional probability vector likes on a (K-1)-simplex. This simplex can be projected onto 2-dimension, with vertices corresponding to the state of the variable (simplex_vertex_projection calculates these co-ordinates). The simplexplot function produces the plot.

Usage

plotsimplex(data, radius = 1, order = NULL, 
  labels_cex = 1, labels = colnames(data), show_labels = TRUE,
  points_col = "#00000044", points_pch = 19, points_cex = 1,
  label_offset = 0.9, 
  projection_vertexes = simplex_vertex_projection(ncol(data), radius), 
  show_points = TRUE, show_circle = TRUE, 
  circle_col = "lightgray", show_edges = TRUE, 
  edges_col = "lightgray", ...)
simplex_vertex_projection(nvert, r=1)

Arguments

data

A data frame or matrix with rows representing individuals, and columns states. The row sums should be one.

radius, r

The radius of the circle on which to plot.

order

Order of the states.

labels_cex

Graphical parameter controlling label size.

labels

Labels for the vertices.

show_labels

Logical, should labels be shown.

points_col

Colours for the points.

points_pch

Glyph for the points.

points_cex

Size for the points.

label_offset

Location for the labels.

projection_vertexes

A function for computing the vertex locations.

show_points

Logical, should the points be plotted.

show_circle

Logical, should the reference cicle be plotted.

circle_col

Logical, colour for the circle.

show_edges

Logical, should the edges be shown.

edges_col

The colour for the edges.

...

extra arguments are ignored.

nvert

The number of vertices.

Details

This function is adapted from the archetypes::simplexplot function. As the probability vector is already a simplex, we don't need the archetypes overhead.

Value

The function simplex_vertex_projection returns a matrix giving the co-ordinates of the vertices.

The function simplexplot is normally called for its side-effects, however, it invisibly returns a data structure containing plot details.

Author(s)

Russell Almond

References

See Section 6 in "Probabilistic Archetypal Analysis" by Seth and Eugster (2014), http://arxiv.org/abs/1312.7604.

This is a simplified version of the code in the archetypes package. https://cran.r-project.org/package=archetypes

See Also

pvecTable

Examples

  data("language16")
  ptab <- pvecTable(language16,"Reading")
  plotsimplex(ptab)

ralmond/CPTtools documentation built on Dec. 27, 2024, 7:15 a.m.