Function Repository Resource:

EssentialAminoAcidsChart

Source Notebook

Create a bar chart comparing the content of the nine essential amino acids in a list of foods

Contributed by: Gay Wilson

ResourceFunction["EssentialAminoAcidsChart"][foods]

returns essential amino acid information in a BarChart for a list of foods.

Details and Options

There are nine amino acids that the human body cannot synthesize on its own to meet its physiological needs: histidine, isoleucine, leucine, lysine, methionine, phenylalanine, threonine, tryptophan and valine. These are the essential amino acids that must be supplied by protein in the diet.
Each bar represents the amount in grams of the corresponding amino acid relative to 1 gram of that food (g/g).
ResourceFunction["EssentialAminoAcidsChart"] takes the same options as BarChart, with the following modifications:
ChartLabelsBeforefood names
ChartLegendsBelownutrient properties
BarOriginLeftorigin placement for bars
FontSize10font size of chart labels and legends
PlotLabel""optional overall label for chart
ImageSize600overall image size expressed in points
ImageMarginsAutomaticabsolute margins around image
BackgroundAutomaticbackground color for chart

Examples

Basic Examples (2) 

Compare the essential amino acids in these fish, which also are good sources of omega-3 fatty acids:

In[1]:=
ResourceFunction[
 "EssentialAminoAcidsChart"][{"trout", "anchovy", "mackerel", "salmon"}]
Out[1]=

Visualize the essential amino acids with a customized chart design:

In[2]:=
ResourceFunction[
 "EssentialAminoAcidsChart"][{"trout", "anchovy", "mackerel", "salmon"}, BarOrigin -> Bottom, ChartLabels -> Below, ChartLegends -> Right, ChartStyle -> "DarkBands", PlotLabel -> "Comparison of Essential Amino Acids"]
Out[2]=

Scope (1) 

Change FontSize for the chart labels and legend:

In[3]:=
ResourceFunction[
 "EssentialAminoAcidsChart"][{"boiled eggs", "pork tenderloin", "feta cheese", "grilled chicken"}, FontSize -> 12, ChartElementFunction -> "ObliqueRectangle"]
Out[3]=

Options (1) 

Use ChartElements and other BarChart options to draw attention to your chart:

In[4]:=
ResourceFunction["EssentialAminoAcidsChart"][{"walnuts"}, ChartElements -> \!\(\*
GraphicsBox[DiskBox[{0, 0}],
ImageSize->{22., Automatic}]\), ChartLabels -> Above, ChartStyle -> "BrightBands", Background -> LightYellow, ImageMargins -> 10, ImageSize -> Medium]
Out[4]=

Neat Examples (2) 

Planning beans or lentils with rice for dinner? Pair different varieties to see the most nutritious combination of essential amino acids:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/2d9b35af-92c1-463d-ae53-bc00a4396216"]
Out[8]=

Write a custom ChartElementFunction for a unique and artistic visualization:

In[9]:=
g[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Polygon[{{xmin, ymin}, {xmax, ymax}, {xmin, ymax}, {xmax, ymin}}]
ResourceFunction["EssentialAminoAcidsChart"][{"cottage cheese"}, ChartElementFunction -> g, BarOrigin -> Bottom, ChartLabels -> Above,
  ChartLegends -> Right, ChartStyle -> "BlueGreenYellow"]
Out[10]=

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.1.0 – 15 May 2024
  • 1.0.0 – 25 March 2024

Related Resources

License Information