spoke | R Documentation |
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).
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",
...
)
pos |
Binary matrix. Elements must be 1s indicating row (label) is associated with column (label) or 0s indicatig no such associations. |
neg |
As |
ontop |
Character. If |
labels |
Character vector. Names to add to plot. If NULL then column names of |
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 |
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 |
ltyNeg |
Integer or character. Line style of "negative" spokes (see |
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 |
None. By-product is a spoke plot.
# 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'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.