View source: R/plotNetworkGgplot.R
plot_troph_level_ggplot | R Documentation |
This function visualizes a food web using ggplot2
, where nodes represent species and edges represent interactions.
Nodes are positioned by trophic level on the y-axis, and optionally, community modules on the x-axis.
plot_troph_level_ggplot(
g,
vertexSizeFactor = 5,
vertexSizeMin = 5,
modules = FALSE,
weights = NA,
community_obj = NULL,
maxTL = NULL,
use_numbers = FALSE,
label_size = 4,
arrow_size = 0.15,
shorten_factor = 0.005
)
g |
An |
vertexSizeFactor |
Numeric factor to determine node size based on degree (default: 5). |
vertexSizeMin |
Numeric value for the minimum node size (default: 5). |
modules |
Logical; if |
weights |
A numeric vector, |
community_obj |
An optional community detection object. If |
maxTL |
Numeric, maximum trophic level to display on the y-axis. If |
use_numbers |
Logical; if |
label_size |
Numeric, font size for node labels (default: 4). |
arrow_size |
Numeric, size of the arrowheads for directed edges (default: 0.15). |
shorten_factor |
Numeric, a small factor to adjust arrow placement by slightly shortening edges.
This prevents arrowheads from overlapping with node centers. A small positive value (e.g., 0.005) works well (default: |
A ggplot
object visualizing the trophic structure of the network.
If use_numbers = TRUE
, it also returns a tibble
mapping numeric labels to species names.
g <- netData$Angola
plot_troph_level_ggplot(g, modules = TRUE, use_numbers = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.