spoke: Spoke plot

View source: R/spoke.r

spokeR Documentation

Spoke plot

Description

This function Creates a "spoke" plot to visualize networks or correlation matrices. Factors are arranged in a circle, and lines connect them if they are linked in some manner (e.g., highly correlated). Two types of spokes formats can be used (e.g., one for positive correlations and negative correlations).

Usage

spoke(
  pos,
  neg = NULL,
  ontop = "pos",
  labels = NULL,
  shrink = 1,
  labelOffset = 1.02,
  nudge = 1,
  pch = 16,
  cexPoints = 1,
  cexLabel = 1,
  lwdPos = 1,
  lwdNeg = 1,
  ltyPos = "solid",
  ltyNeg = "dashed",
  colPos = "black",
  colNeg = "black",
  colPoints = "black",
  colLabel = "black",
  ...
)

Arguments

pos

Binary matrix. Elements must be 1s indicating row (label) is associated with column (label) or 0s indicatig no such associations.

neg

As pos, but indicating "negative" associations (however defined).

ontop

Character. If 'pos' then plot positive association spokes first; if 'neg' then plot negative associations first.

labels

Character vector. Names to add to plot. If NULL then column names of pos will be used (if any).

shrink

Numeric. Relative size of non-label part of plot. This is useful if labels are too long to fit onto a plot. Default = 1.

labelOffset

Numeric. Indicates how far from points labels are placed. If 1, then labels are placed on points, >1 then labels are placed outside points, and if <1 inside points.

nudge

Factor by which to multiple y-coordinates of labels. Default is 1. Useful if there are many labels and they tend to overlap one another.

pch

Integer. Point style (leave as NA to plot no points).

cexPoints

Positive integer. Size of points

cexLabel

Integer. Size of labels

lwdPos

Numeric. Line width of "positive" spokes.

lwdNeg

Numeric. Line width of "negative" spokes.

ltyPos

Integer or character. Line style of "positive" spokes (see ?lines).

ltyNeg

Integer or character. Line style of "negative" spokes (see ?lines).

colPos

Integer or character. Color of "positive" spokes.

colNeg

Integer or character. Color of "negative" spokes.

colPoints

Integer or character. Color of points.

colLabel

Integer or character. Color of labels.

...

Further arguments to pass to plot(), points(), lines(), or text().

Value

None. By-product is a spoke plot.

Examples

# create matrix of correlation coefficients from some data
d <- data.frame(a=1:100, b=(1:100)^2, c=-(1:100), d=(1:100)^3, e=-(1:100)^3)
correl <- cor(d)
pos <- correl >= 0.95
neg <- correl <= -0.95
spoke(pos, neg)
legend('bottomright', legend=c('Positive', 'Negative'), lty=c('solid', 'dashed'))

adamlilith/legendary documentation built on July 28, 2023, 8:13 p.m.