plot.select | R Documentation |
select
ObjectsVisualize the conditional (in)dependence structure.
## S3 method for class 'select'
plot(
x,
layout = "circle",
pos_col = "#009E73",
neg_col = "#D55E00",
node_size = 10,
edge_magnify = 1,
groups = NULL,
palette = "Set3",
...
)
x |
An object of class |
layout |
Character string. Which graph layout (defaults is |
pos_col |
Character string. Color for the positive edges (defaults to |
neg_col |
Character string. Color for the negative edges (defaults to |
node_size |
Numeric. The size of the nodes (defaults to |
edge_magnify |
Numeric. A value that is multiplied by the edge weights. This increases (> 1) or decrease (< 1) the line widths (defaults to 1). |
groups |
A character string of length p (the number of nodes in the model). This indicates groups of nodes that should be the same color (e.g., "clusters" or "communities"). |
palette |
A character string sepcifying the palette for the |
... |
Additional options passed to ggnet2 |
An object (or list of objects) of class ggplot
that can then be further customized.
A more extensive example of a custom plot is provided here
#########################
### example 1: one ggm ##
#########################
# data
Y <- bfi[,1:25]
# estimate
fit <- estimate(Y, iter = 250,
progress = FALSE)
# "communities"
comm <- substring(colnames(Y), 1, 1)
# edge set
E <- select(fit)
# plot edge set
plt_E <- plot(E, edge_magnify = 5,
palette = "Set1",
groups = comm)
#############################
### example 2: ggm compare ##
#############################
# compare males vs. females
# data
Y <- bfi[,1:26]
Ym <- subset(Y, gender == 1,
select = -gender)
Yf <- subset(Y, gender == 2,
select = -gender)
# estimate
fit <- ggm_compare_estimate(Ym, Yf, iter = 250,
progress = FALSE)
# "communities"
comm <- substring(colnames(Ym), 1, 1)
# edge set
E <- select(fit)
# plot edge set
plt_E <- plot(E, edge_magnify = 5,
palette = "Set1",
groups = comm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.