R/jamenrich-igraph.r
spread_igraph_labels.Rd
Spread igraph node labels by angle from node center
spread_igraph_labels(
g,
layout = NULL,
y_bias = 1,
update_g_coords = TRUE,
do_reorder = TRUE,
sortAttributes = NULL,
nodeSortBy = c("x", "-y"),
repulse = 3.5,
force_relayout = FALSE,
label_min_dist = 0.5,
verbose = FALSE,
...
)
igraph object
numeric matrix representing the x and y
coordinates of each node in g
, in the same order as V(g)
.
When layout
is not supplied, nodes are checked for
attributes c("x", "y")
which define a fixed internal
layout. When force_layout=TRUE
these coordinates are ignored.
If that is not supplied, then layout_with_qfr()
is called along with the repulse
argument. Subsequent
coordinates are stored in V(g)$x
and V(g)$y
when
argument update_g_coords=TRUE
.
numeric value indicating the tendency to spread labels on the y-axis rather than symmetrically around each node. This argument elongates the circle surrounding a node into an ellipse with this ratio.
logical indicating whether the layout
coordinates will be stored in graph_attr(g, "layout")
.
logical indicating whether to call
reorderIgraphNodes()
which re-distributes equivalent nodes
based upon the node color(s). A node is "equivalent" to another
node if both nodes have identical edges.
arguments passed to
reorderIgraphNodes()
when do_reorder=TRUE
.
argument passed to layout_with_qfr()
only
when layout
is not supplied, and the layout is not stored
in c(V(g)$x, V(g)$y)
.
logical indicating whether the igraph
layout
should be recalculated, in order to override coordinates that
may be previously stored in the igraph
object itself.
Note that when layout
is supplied, it is always used.
numeric value used to ensure all labels are at least some distance from the center. These units are defined by igraph, and are roughly in units of one line height of text.
additional arguments are passed to layout_with_qfr()
when needed.
This function uses the igraph vertex attribute
"label.degree"
, which describes the angular offset for
each vertex label. (The "label.degree"
values are
represented as radians, not degrees, starting at 0 for
right, and proceeding clockwise starting from the right,
down, left, top, right.)
This function requires a network layout, which must be fixed in order for the vertex labels to be properly oriented. Labels are oriented opposite the most dominant angular mean of edges from each network node. Typically the side of a node with the fewest edges has the most space to place a label. No further checks are performed for overlapping labels.
Note that this function only modifies the other important
attribute "label.dist"
when `label_min_dist`` is defined,
in order to enforce a minimum label distance from the center
of each node. There is no other logic to position small or
large labels to avoid overlapping labels.
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()
,
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()
,
subgraph_jam()
,
subsetCnetIgraph()
,
subset_igraph_components()
,
sync_igraph_communities()
,
with_qfr()