set_color: Set colors for the communities in the network

Description Usage Arguments Examples

View source: R/set_colors.r

Description

Visualizes the network by adding different colors to different species communities, when plotting either with R own color list or a provided color list.

Usage

1
set_color(graph, colors_list = "")

Arguments

graph

The igraph object used to define colors. The nodes accessed with V() should have a $tax attribute which links them to a community, so a different color can be assigned to each community.

colors_list

Optional; the colors can be defined in a list with the community names defined with names(). Otherwise, the function will return the numbers already associated to R colors.

Examples

1
2
3
4
foo_CAT_env <- c("red","green","blue","grey")
names(foo_CAT_env) = c("host","ubiquitous","water","unknown")
CAT_env <- set_color(CAT_env, foo_CAT_env)
plot(CAT_env)

XPHenry/Netfrac documentation built on Jan. 29, 2020, 12:14 p.m.