Skip to contents

Foods are coloured by food group. The top n_label foods by combined rank are labelled with ggrepel.

Usage

plot_nutrient_scatter(
  x_table,
  x_col,
  y_table,
  y_col,
  n_label = 20L,
  log_x = FALSE,
  log_y = FALSE,
  label_fn = .short_label,
  title = NULL,
  subtitle = NULL
)

Arguments

x_table, y_table

IFCT table names. Supply the same value for both when both nutrients come from one table.

x_col, y_col

Exact column names for x and y.

n_label

Number of foods to label (default 20).

log_x, log_y

Log10-scale each axis (default FALSE).

label_fn

Function to shorten food names.

title, subtitle

Plot labels.

Value

A ggplot2 object.

Examples

plot_nutrient_scatter(
  x_table = "proximate", x_col = "TotalDietaryFibre_FIBTG(g)",
  y_table = "minerals", y_col = "Calcium_Ca(mg)",
  log_x = TRUE, log_y = TRUE
)