Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a dual bar chart comparing the calories and macronutrients in a list of foods
ResourceFunction["NutrientComparisonBarChart"][foods] returns nutrition information in BarChart form for a list of foods. |
| ChartLabels | Before | placement of food names |
| ChartStyle | Automatic | graphics style for charts |
| ChartLegends | Below | placement of nutrient properties |
| BarOrigin | Left | origin placement for bars |
| BarSpacing | Automatic | spacing between bars and bar groups |
| FontSize | 10 | font size of chart labels and legends |
| PlotLabel | "" | optional overall label for both charts |
| ImageSize | 600 | overall image size expressed in points |
| ImageMargins | Automatic | absolute margins around image |
| Background | Automatic | background color for the charts |
Compare the relative calories and macronutrients of raw fruits:
| In[1]:= | ![]() |
| Out[1]= | ![]() |
Visualize the nutrients in high-protein foods with a customized chart design:
| In[2]:= | ![]() |
| Out[2]= | ![]() |
You can use Wolfram Language food entities directly, mapping the entities to food strings for the chart labels:
| In[3]:= | ![]() |
| Out[3]= | ![]() |
Create a vertical bar chart of grains with specified image size and labelings:
| In[4]:= | ![]() |
| Out[4]= | ![]() |
Have fun with the ChartStyle options named for foods, such as AvocadoColors, CandyColors, CherryTones, CoffeeTones, FruitPunchColors, MintColors, PlumColors and WatermelonColors:
| In[5]:= |
| Out[5]= | ![]() |
| In[6]:= | ![]() |
| Out[6]= | ![]() |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License