View source: R/assignEvolutionColors.R
| assignEvolutionColors | R Documentation |
This function assigns colors to nodes in a thematic evolution analysis based on their lineages across time periods. Nodes connected by strong edges (above a threshold) receive the same color to visualize thematic continuity. Nodes with the same name across periods that are not strongly connected to other nodes are also colored identically.
assignEvolutionColors(
nexus,
threshold = 0.5,
palette = NULL,
use_measure = "weighted"
)
nexus |
A list object returned by
|
threshold |
Numeric. The minimum weight value for an edge to be considered a "strong connection" (default: 0.5). Edges with weights >= threshold will propagate the same color to connected nodes across periods. |
palette |
Character vector. Optional custom color palette as hex codes. If NULL, uses a default palette of 50+ distinct colors. Colors are assigned sequentially without reuse. |
use_measure |
Character. The measure to use for determining edge strength. Can be one of:
Default is "inclusion". |
The function uses a multi-phase algorithm:
Phase 1: Identifies lineages by following strong connections (weight >= threshold) from the first period forward. When a node has multiple strong connections, the strongest one determines the lineage.
Phase 1.5: Assigns the same lineage to nodes with identical names across periods if they are not already part of different strong connections.
Phase 2: Assigns unique colors from the palette to each identified lineage.
Phase 3: Assigns unique colors to isolated nodes (those without any lineage).
Phase 4: Colors edges based on their connected nodes - same color if both nodes share a color, grey otherwise.
Final: Updates thematic maps with the new color scheme.
Each lineage receives a unique color from the palette. No color is reused across different lineages, ensuring clear visual distinction between independent thematic streams.
Returns the modified nexus object with updated colors:
Nodes$color: updated with lineage-based colors
Edges$color: edges connecting same-colored nodes receive the node color,
others are grey
TM: thematic maps updated with new cluster colors
thematicEvolution to perform thematic evolution analysis.
plotThematicEvolution to visualize the colored evolution.
## Not run:
data(scientometrics, package = "bibliometrixData")
years <- c(2000, 2010)
nexus <- thematicEvolution(scientometrics, field = "ID",
years = years, n = 100, minFreq = 2)
# Use custom threshold and measure
nexus <- assignEvolutionColors(nexus, threshold = 0.6, use_measure = "weighted")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.