| plot_mcml | R Documentation |
Produces a two-layer hierarchical visualization of a clustered network.
The bottom layer shows every node inside an elliptical cluster shell, with
the within-cluster and between-cluster edges of the individual nodes. The
top layer shows one summary node per cluster, with edges carrying the
aggregated between-cluster weights. By default the colored slice of a
summary node is the cluster's share of the initial state distribution
(see summary_pie). Dashed lines connect each detail node to its
summary node.
plot_mcml(
x,
cluster_list = NULL,
expand = NULL,
mode = c("weights", "tna"),
theme = c("classic", "rich", "light"),
layer_spacing = NULL,
spacing = 3,
shape_size = 1.2,
summary_size = 4,
skew_angle = 60,
aggregation = c("sum", "mean", "max"),
minimum = 0,
colors = NULL,
legend = TRUE,
show_labels = TRUE,
nodes = NULL,
label_size = NULL,
label_abbrev = NULL,
node_size = 2.4,
node_shape = "circle",
cluster_shape = "circle",
title = NULL,
subtitle = NULL,
title_size = 1.2,
subtitle_size = 0.9,
legend_position = "right",
legend_size = 0.7,
legend_pt_size = 1.2,
summary_labels = TRUE,
summary_label_size = 0.8,
summary_label_position = 3,
summary_label_color = "gray20",
summary_arrows = TRUE,
summary_arrow_size = 0.1,
node_donut = NULL,
node_donut_inner_ratio = 0.55,
summary_donut_inner_ratio = 0.6,
summary_donut_show_value = FALSE,
curved_edges = NULL,
summary_curve = NULL,
summary_pie = c("inits", "self"),
edge_color_by = c("auto", "cluster", "sign"),
edge_positive_color = "#2E7D32",
edge_negative_color = "#C62828",
between_arrows = FALSE,
edge_width_range = c(0.3, 1.3),
between_edge_width_range = c(0.5, 2),
summary_edge_width_range = c(0.5, 2),
edge_alpha = 0.35,
between_edge_alpha = 0.6,
summary_edge_alpha = 0.7,
inter_layer_alpha = 0.5,
edge_labels = FALSE,
edge_label_size = 0.5,
edge_label_color = "gray40",
edge_label_digits = 2,
summary_edge_labels = FALSE,
summary_edge_label_size = 0.6,
top_layer_scale = c(0.8, 0.25),
inter_layer_gap = 0.6,
node_radius_scale = 0.55,
shell_alpha = 0.15,
shell_border_width = 0.75,
node_border_color = "gray30",
node_border_width = 0.4,
summary_border_color = "gray20",
summary_border_width = 0.6,
label_color = "gray20",
label_position = 3,
directed = NULL,
...
)
x |
A square weight matrix with row and column names matching the
node names in |
cluster_list |
Assignment of nodes to clusters. A named list of
character vectors gives the node names of each cluster, and the list
names become the cluster labels, for example
|
expand |
Names of clusters whose member states are shown as separate
nodes in the summary layer. |
mode |
|
theme |
Visual preset, one of |
layer_spacing |
Vertical position of the summary layer, which sets
the height of the figure. |
spacing |
Distance from the center to each cluster in the bottom layer. Default 3. |
shape_size |
Radius of each cluster shell in the bottom layer. Default 1.2. |
summary_size |
Size of the summary nodes. The radius of a summary
node is |
skew_angle |
Perspective tilt in degrees, from 0 to 90. At 0 the bottom layer is seen from directly above and at 90 it collapses to a line. Default 60. |
aggregation |
Method for aggregating node-level edge weights into
cluster-level weights: |
minimum |
Edge weight threshold. Edges whose absolute weight does not exceed this value are not plotted. Default 0. |
colors |
Character vector of cluster colors, recycled to the number
of clusters. |
legend |
Logical. Add a legend of cluster colors. Default
|
show_labels |
Logical. Show node labels in the bottom layer. Default
|
nodes |
Node metadata data frame for display labels. Its
|
label_size |
Text size ( |
label_abbrev |
Label abbreviation passed to |
node_size |
Size of the detail nodes. The radius of a detail node is
|
node_shape |
Shape of the detail nodes, a single value or one value
per node. |
cluster_shape |
Not used. It is kept for compatibility with earlier versions. |
title |
Plot title. Default |
subtitle |
Subtitle shown below the figure. Default |
title_size |
Text size ( |
subtitle_size |
Text size ( |
legend_position |
Legend position: |
legend_size |
Text size ( |
legend_pt_size |
Point size ( |
summary_labels |
Logical. Show cluster names next to the summary
nodes. Default |
summary_label_size |
Text size of summary labels. Default 0.8. |
summary_label_position |
Position of summary labels relative to their nodes: 1 = below, 2 = left, 3 = above, 4 = right. When it is not supplied, each label is placed on the side of its node that faces away from the center of the summary layer. |
summary_label_color |
Color of summary labels. Default
|
summary_arrows |
Logical. Add arrowheads to summary edges. Default
|
summary_arrow_size |
Size of the arrowheads on summary edges. Default 0.10. |
node_donut |
Logical or |
node_donut_inner_ratio |
Hole size, from 0 to 1, of the detail-node donut. Default 0.55. |
summary_donut_inner_ratio |
Hole size, from 0 to 1, of the summary donut. Default 0.6. |
summary_donut_show_value |
Logical. Print the fill proportion in the
center of each summary donut. Default |
curved_edges |
Logical or |
summary_curve |
Numeric or |
summary_pie |
What the colored slice of a summary node shows.
|
edge_color_by |
Edge coloring on all layers. |
edge_positive_color |
Color of positive edges under sign coloring.
Default |
edge_negative_color |
Color of negative edges under sign coloring.
Default |
between_arrows |
Logical. Add arrowheads to between-cluster edges in
the bottom layer. Default |
edge_width_range |
Numeric vector |
between_edge_width_range |
Numeric vector |
summary_edge_width_range |
Numeric vector |
edge_alpha |
Opacity, from 0 to 1, of within-cluster edges. Default 0.35. |
between_edge_alpha |
Opacity, from 0 to 1, of between-cluster edges. Default 0.6. |
summary_edge_alpha |
Opacity, from 0 to 1, of summary edges. Default 0.7. |
inter_layer_alpha |
Opacity, from 0 to 1, of the dashed inter-layer lines. Default 0.5. |
edge_labels |
Logical. Show weight labels on within-cluster edges.
Default |
edge_label_size |
Text size of within-cluster edge labels. Default 0.5. |
edge_label_color |
Color of within-cluster edge labels. Default
|
edge_label_digits |
Number of decimal places of edge labels on both layers. Default 2. |
summary_edge_labels |
Logical. Show weight labels on summary edges.
Default |
summary_edge_label_size |
Text size of summary edge labels. Default 0.6. |
top_layer_scale |
Numeric vector |
inter_layer_gap |
Vertical distance from the upper edge of the bottom
layer to the center of the summary layer, as a multiple of
|
node_radius_scale |
Radius of the circle of nodes inside each cluster
shell, as a fraction of |
shell_alpha |
Fill opacity, from 0 to 1, of the cluster shells.
Default 0.15, or 0.10 with |
shell_border_width |
Line width of the cluster shell borders. Default
0.75, or 0 with |
node_border_color |
Border color of the detail nodes. Default
|
node_border_width |
Border width of the detail nodes. Default 0.4. |
summary_border_color |
Border color of the summary nodes. Default
|
summary_border_width |
Border width of the summary nodes. Default 0.6. |
label_color |
Text color of detail node labels. Default
|
label_position |
Not used. Detail labels are placed to the left or right of each node according to its position in the shell. |
directed |
Logical or |
... |
Not used. |
For a multi-cluster plot without the summary layer, see
plot_mtna. For stacked multilevel or multiplex layers, see
plot_mlna.
A weight matrix, tna object or cograph_network is passed together with
cluster_list, and the aggregated weights are computed with
csum. A cluster_summary computed beforehand with
csum can be passed as x instead, which avoids
repeating the aggregation when the same clustering is plotted several
times.
For a directed network the aggregated weights are computed with
type = "tna", so each row of the summary matrix sums to 1. For an
undirected network they are computed with type = "cooccurrence".
The mode argument changes only the default of the edge labels.
Bottom-layer clusters are arranged on a circle of radius spacing,
flattened by the perspective skew_angle. Nodes inside each cluster
sit on a smaller circle of radius shape_size * node_radius_scale.
The summary nodes are placed on an oval above the bottom layer whose radii
are set by top_layer_scale.
Invisibly, the cluster_summary object used for plotting. It
can be passed back to plot_mcml(), printed, or converted with
as_tna.
The plot contains four kinds of edges, each with its own visual parameters.
Edges between nodes of the same cluster,
set by edge_width_range, edge_alpha, edge_labels,
edge_label_size, edge_label_color and
edge_label_digits.
Edges between cluster shells, set by
between_edge_width_range, between_edge_alpha and
between_arrows.
Edges between summary nodes, set by
summary_edge_width_range, summary_edge_alpha,
summary_edge_labels, summary_edge_label_size,
summary_arrows and summary_arrow_size.
Lines from each detail node to its summary
node, set by inter_layer_alpha.
csum for the aggregated cluster data,
plot_mtna for a multi-cluster plot without a summary layer,
plot_mlna for stacked multilevel or multiplex layers,
detect_communities for algorithmic cluster detection
clusters <- list(C1 = c("Explore", "Reflect", "Discuss"),
C2 = c("Plan", "Create", "Share"),
C3 = c("Monitor", "Adapt", "Synthesize", "Evaluate"))
plot_mcml(regulation_net, clusters)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.