Learn R Programming

foodingraph (version 0.1.0)

family_palette: Generate a color palette for nodes family

Description

From a list of food families, create a color for each family.

Usage

family_palette(family)

Arguments

family

(list) : can be either the family column from the legend table, or just a list of the families. In all cases, the parameter will be converted as a factor and sorted (alphabetically or numerically) Only its unique values are necessary.

Value

A list of key and values. - keys are the family names - values are the color

Details

Very useful when comparing graphs with the same families. It can be used by itself, but this function was created to be the family_palette argument when calling display_graph_from_links_nodes() The colors will be automatically added to the graph (nodes and legend)

Examples

Run this code
# NOT RUN {
family_palette(c("Fruits", "Vegetables", "Meats"))
# }

Run the code above in your browser using DataLab