edge_bundle_nodegroups | R Documentation |
Bundle edges using node groups
edge_bundle_nodegroups(
g,
nodegroups,
shape = NULL,
params = NULL,
midpoint = 0.5,
detail = 10,
draw_lines = TRUE,
nodegroup_midpoints = NULL,
linear_cor_threshold = 1,
bundle_style = getOption("jam.bundle_style", "bezier"),
bundle_self = FALSE,
verbose = FALSE,
debug = getOption("debug", FALSE),
...
)
g |
|
nodegroups |
|
shape |
|
params |
|
midpoint |
|
detail |
|
draw_lines |
|
nodegroup_midpoints |
|
linear_cor_threshold |
The driving problem is when the control point is colinear with two nodes, and the control point is positioned outside the two nodes. Without this modification, the line would appear to pass from one node beyond the other node, with an arrow (if directed) pointing back to the other node from the opposite direction. |
bundle_style |
|
bundle_self |
|
verbose |
|
debug |
|
... |
additional arguments are ignored. |
This edge bundling technique relies upon some form of
node grouping, usually derived from network community
detection, or from bipartite nodesets (see
get_bipartite_nodeset()
for details.)
Given a set of node groups, edges are bundled entering and exiting each node group, along the linear path between the two node group center positions, using a spline function and intermediate control points.
The default spline uses the initial node positions, and the
midpoint along the line between the two respective node groups.
The midpoints can be adjusted with the argument midpoint
and a vector of one or more fractional positions between 0
and 1
.
A useful alternative is midpoint=c(0.3, 0.7)
which adds
two control points along the linear path between node group
centers, and tends to make the edges bundle closer together
for a longer distance.
When used with bipartite nodesets, edges are bundled between
each nodeset and individual nodes. The edge bundling rules are
the same, with the default midpoint=c(0.4, 0.6)
being centered at half
the distance between the nodeset center, and the single node.
In this case, the midpoint
is directional, always pointing
from the nodeset to the single node, therefore can be adjusted
closer to the nodeset center with midpoint=0.2
or closer to
the single node with midpoint=0.8
.
data.frame
with each edge spline point represented
on its own row, with breaks in edges defined by NA
coordinates.
Other jam igraph functions:
cnet2df()
,
cnet2im()
,
cnetplotJam()
,
cnetplot_internalJam()
,
color_edges_by_nodegroups()
,
color_edges_by_nodes_deprecated()
,
color_edges_by_nodes()
,
color_nodes_by_nodegroups()
,
communities2nodegroups()
,
drawEllipse()
,
edge_bundle_bipartite()
,
enrichMapJam()
,
fixSetLabels()
,
flip_edges()
,
get_bipartite_nodeset()
,
igraph2pieGraph()
,
jam_igraph()
,
jam_plot_igraph()
,
label_communities()
,
layout_with_qfrf()
,
layout_with_qfr()
,
mem2emap()
,
memIM2cnet()
,
mem_multienrichplot()
,
nodegroups2communities()
,
rectifyPiegraph()
,
relayout_with_qfr()
,
removeIgraphBlanks()
,
removeIgraphSinglets()
,
reorderIgraphNodes()
,
rotate_igraph_layout()
,
spread_igraph_labels()
,
subgraph_jam()
,
subsetCnetIgraph()
,
subset_igraph_components()
,
sync_igraph_communities()
,
with_qfr()
# using community detection
karate <- igraph::make_graph("Zachary")
igraph::V(karate)$name <- as.character(seq_len(igraph::vcount(karate)))
# run any igraph::cluster_*()
wc <- igraph::cluster_louvain(karate)
# define list
nodegroups_wc <- split(igraph::V(karate)$name, wc$membership)
# bonus points for colorizing nodes and edges by community
igraph::V(karate)$color <- colorjam::group2colors(igraph::membership(wc));
igraph::V(karate)$label.color <- jamba::setTextContrastColor(igraph::V(karate)$color);
igraph::V(karate)$frame.color <- jamba::makeColorDarker(igraph::V(karate)$color);
karate <- color_edges_by_nodes(karate);
# update graph layout
layout_xy <- igraph::layout_with_graphopt(karate);
igraph::graph_attr(karate, "layout") <- layout_xy;
jam_igraph(karate,
edge_bundling="nodegroups",
nodegroups=nodegroups_wc,
use_shadowText=TRUE);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.