jam_plot_igraph | R Documentation |
Jam igraph vectorized plot internal function called by jam_igraph()
jam_plot_igraph(
x,
...,
axes = FALSE,
add = FALSE,
xlim = NULL,
ylim = NULL,
mark.groups = list(),
mark.shape = 1/2,
mark.col = NULL,
mark.alpha = 0.2,
mark.border = NULL,
mark.expand = 8,
mark.lwd = 2,
mark.lty = 1,
mark.smooth = TRUE,
mark.cex = 1,
mark.x.nudge = 0,
mark.y.nudge = 0,
pie_to_jampie = TRUE,
use_shadowText = FALSE,
vectorized_node_shapes = TRUE,
edge_bundling = c("default", "connections", "none", "mark.groups", "nodegroups"),
bundle_self = FALSE,
nodegroups = NULL,
render_nodes = TRUE,
render_edges = TRUE,
render_groups = TRUE,
render_nodelabels = TRUE,
params = NULL,
plot_grid = FALSE,
verbose = FALSE,
debug = NULL
)
x |
The graph to plot. |
... |
Additional plotting parameters. See igraph.plotting for the complete list. |
axes |
Logical, whether to plot axes, defaults to FALSE. |
add |
Logical scalar, whether to add the plot to the current device, or delete the device's current contents first. |
xlim , ylim |
default x and y axis limits. When either value is |
mark.groups |
A list of vertex id vectors. It is interpreted as a set of vertex groups. Each vertex group is highlighted, by plotting a colored smoothed polygon around and “under” it. See the arguments below to control the look of the polygons. |
mark.shape |
A numeric scalar or vector. Controls the smoothness of the
vertex group marking polygons. This is basically the ‘shape’
parameter of the |
mark.col |
A scalar or vector giving the colors of marking the
polygons, in any format accepted by |
mark.alpha |
|
mark.border |
A scalar or vector giving the colors of the borders of
the vertex group marking polygons. If it is |
mark.expand |
A numeric scalar or vector, the size of the border around the marked vertex groups. It is in the same units as the vertex sizes. If a vector is given, then different values are used for the different vertex groups. |
mark.lwd , mark.lty |
line with and line type parameters for each
|
mark.cex |
|
mark.x.nudge , mark.y.nudge |
|
pie_to_jampie |
|
use_shadowText |
|
vectorized_node_shapes |
|
edge_bundling |
|
nodegroups |
|
render_nodes , render_edges |
|
render_groups |
|
render_nodelabels |
|
plot_grid |
|
verbose |
|
debug |
|
Note that this function is intended to be called by jam_igraph()
,
and is an internal function not intended to be called directly.
The jam_igraph()
handles the overall plot equivalent of
igraph::plot.igraph()
, however it calculates layout coordinates,
and defines more useful x- and y-axis ranges, and then
adjusts node and label sizes relevant to the layout data range.
Specifically vertex.size=15
is only useful when the layout range
is rescaled between -1 and 1; however when using jam_igraph()
the vertex is scaled relative to the actual layout ranges.
The steps here are a reproduction of igraph:::plot.igraph()
with
four changes:
Default rescale=FALSE
, and asp=1
which means igraph layout is
drawn true to the layout coordinates without distortion. To use
default igraph::plot.igraph()
behavior, use rescale=TRUE
.
The new default may not be appropriate for bipartite layout
algorithms that generate two columns, and seems most useful
with organic layouts where aspect ratio 1 helps convey important
meaning in the graph structure, namely by enforcing consistent
x- and y-axis visual distance between nodes.
Related: the xlim
and ylim
values are automatically adjusted
to include the layout coordinate range. The default
igraph::plot.igraph(..., rescale=FALSE)
does not adjust the
xlim
and ylim
ranges, which can be problematic when supplying
layout as a function, and therefore the output node coordinates
are not known until the plot rendering step.
When vectorized_node_shapes=TRUE
by default:
When there are multiple different vertex "shape"
attributes, the
nodes are rendered vectorized one shape at a time. The original
igraph::plot.igraph()
draws each individual vertex one by one,
which is substantially slower (minutes compared to 1-2 seconds)
for large igraph
objects.
When there are multiple font families, the default plot function
draws each label one by one. The jam_plot_igraph()
draws
labels in groups of font family, in order to comply with limitations
in graphics::text()
. This situation is fairly rare, however
the speed improvement is substantial, again roughly minutes down
to 1-2 seconds.
The fourth difference involves edge bundling:
When edge_bundling
is used, it renders edges differently
than the approach in igraph::plot.igraph()
, by drawing curved
splines for each bundle of edges.
Some other distinctive features include:
When use_shadowText=TRUE
node labels call jamba::shadowText()
which draws a small partly transparent outline around labels, making
them more legible when they overlap colored nodes. This step
effectively draws each label n
times, which can slightly slow
the rendering of the overall figure.
When pie_to_jampie=TRUE
, any nodes with shape="pie"
are
changed to shape="jampie"
for the purpose of rendering pie
shapes in vectorized fashion, instead of being drawn for each
node separately. This change is a substantial improvement in
rendering time.
Default colors for marked node groups mark.col
and mark.border
when not defined upfront, will call colorjam::rainbowJam()
and not grDevices::rainbow(). The
colorjam::rainbowJam()produces more visually distinct categorical colors. This behavior can be controlled by supplying a
charactervector with specific colors for
mark.coland
mark.border. Note that the border should match the colors, or it can be set to
"grey45"'
for a generally visible border.
Optional argument nodegroups
can be supplied, which is a list
of vectors, where each vector represents a group of nodes. The
nodegroups
can be used with edge_bundling="nodegroups"
to
define custom edge bundling.
Finally, individual plot components can be individually disabled:
render_nodes=FALSE
render_edges=FALSE
render_groups=FALSE
render_nodelabels=FALSE
Note that this function is not called by default, and is only called
by multienrichjam::jam_igraph()
.
All other arguments are documented in igraph::plot.igraph()
.
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()
,
edge_bundle_nodegroups()
,
enrichMapJam()
,
fixSetLabels()
,
flip_edges()
,
get_bipartite_nodeset()
,
igraph2pieGraph()
,
jam_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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.