assignEvolutionColors: Assign Colors to Thematic Evolution Nodes Based on Lineages

View source: R/assignEvolutionColors.R

assignEvolutionColorsR Documentation

Assign Colors to Thematic Evolution Nodes Based on Lineages

Description

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.

Usage

assignEvolutionColors(nexus, threshold = 0.5, palette = NULL, alpha = 0.5)

Arguments

nexus

A list object returned by thematicEvolution containing:

  • Nodes: data frame with node information (name, group, id, sum, freq, etc.)

  • Edges: data frame with edge information (from, to, weight measures)

  • TM: list of thematic maps for each period

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.

alpha

Numeric. Balancing parameters between inclusion and importance measures. Default value is 0.5.

Details

The function uses a multi-phase algorithm:

  1. 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.

  2. Phase 1.5: Assigns the same lineage to nodes with identical names across periods if they are not already part of different strong connections.

  3. Phase 2: Assigns unique colors from the palette to each identified lineage.

  4. Phase 3: Assigns unique colors to isolated nodes (those without any lineage).

  5. Phase 4: Colors edges based on their connected nodes - same color if both nodes share a color, grey otherwise.

  6. 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.

Value

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

See Also

thematicEvolution to perform thematic evolution analysis.

plotThematicEvolution to visualize the colored evolution.

Examples

## 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)


bibliometrix documentation built on April 9, 2026, 9:06 a.m.