Skip to contents

Assign a color to each node of a network depending of a certain taxonomic level, for example, the phylum.

Usage

v_colored(g, T_table, g_tax, p_tax, g_colors)

Arguments

g

An igraph object.

T_table

Taxa table as data.frame.

g_tax

The taxonomic level at which the nodes will be colored.

p_tax

The taxonomic level at which the network was built.

g_colors

Set of colors. The vector must have the same length of g_tax elements.

Value

An igraph object.

Examples


# Load this library to create a vector with colors
library(viridis)

data ("net_dstoolA")

g <- v_colored(net_dstoolA, T_table = david_stool_lineages, g_tax = "Class", p_tax = "Family", g_colors = c)
#> Error in `[.data.frame`(T_table, , g_tax): undefined columns selected

plot(g)
#> Error: object 'g' not found