Skip to contents

For each IFCT table in the meal, draws a horizontal stacked bar where each segment is one ingredient's contribution. Tables with all-zero nutrients are skipped.

Usage

plot_meal_profile(
  meal,
  tables = c("proximate", "minerals", "vitamins_water", "amino_acids"),
  label_fn = function(x) gsub("_.*", "", x),
  ncol = 2L,
  title = "Meal nutrient profile"
)

Arguments

meal

Named list returned by compose_meal().

tables

Character vector of table names to plot. Defaults to c("proximate", "minerals", "vitamins_water", "amino_acids").

label_fn

Function to shorten nutrient column names.

ncol

Number of panel columns (passed to patchwork::wrap_plots()).

title

Overall plot title.

Value

A patchwork object.

Examples

meal <- compose_meal(c("Rice" = 150, "Dal" = 100))
#>  Meal composed: 2 ingredients across 12 tables.
plot_meal_profile(meal)