Say Cheese!
The following was written by Isabel Skidmore and was originally published on the Wolfram Blog. The original post can be viewed here.
We think about it, talk about it, dream about it and sometimes even argue about it.
What is it?
Food!
March is National Nutrition Month, and I want to share with you how we can celebrate it with the Wolfram Language. We’ll explore ways to analyze and visualize the incredible amount of food and nutrition data available to you in Wolfram|Alpha.
Go Bananas with Images
Did you know that Wolfram|Alpha has nutritional data on 150 types of fruit?
Using the ImageCollage function, you can quickly create a colorful snapshot of the many fruits in the Wolfram Knowledgebase.
First, find all instances of FoodType that are within the FoodTypeGroup “Fruits”:
Next, get the image for each of these, and use DeleteMissing to remove any missing values from the list:
Finally, use ImageCollage to create a vibrant collage of the fruit images:
To produce the same type of image collage for different types of pasta, just replace each use of “fruit” or “Fruits” from the earlier code with “pasta” or “Pastas”:
Try these other food groups to create a whole gallery of Wolfram|Alpha image collages to celebrate National Nutrition Month:
- “Berries”
- “Breads”
- “Cheeses”
- “Legumes”
A Cloud of Carbs
These days, many people have questions about the “carbs” in their food. The Wolfram Language makes answering those questions informative and fun. A word cloud is the perfect way to quickly illustrate the relative carbohydrate content in different grains.
First, find all instances of FoodType that are within the BasicFoodGroup “Grains”:
Next, retrieve the relative carbohydrate content and names for all the food types included in the “Grains” EntityClass:
Finally, use WordCloud to create a colorful and informative graphic. The larger the word, the greater the number of relative carbs!
Try these other relative comparisons to create vibrant and educational word clouds:
- “fruits” and RelativeVitaminCContent
- “dairy” and RelativeCalciumContent
Navigating a World of Flavors
Many of us enjoy trying new foods and flavors from around the world. Wolfram|Alpha has nutritional data about the foods that sometimes travel many miles before arriving on our plates.
CompassPlot is a quick and easy function in the Wolfram Language for learning about the macronutrient content of exotic and delicious foods like these fruits:
You can use CompassPlot to check out “Fig”, “Lychee”, “Banana”, “Jackfruit”, “Coconut”, “Tamarind” and “Durian” — the fruit famous (or infamous) for its pungent smell:
CompassPlot is perfect for exploring the nutritional makeup of your favorite pasta. For example, let’s take a look at “Orecchiette” pasta:
Did you know that “orecchiette” translates to “little ear”? This picture shows why that is:
You can also use the Wolfram Language to analyze the protein and fat content of your favorite international meats and cheeses:
See how these compare with “Ricotta”, “Bratwurst” and “Prosciutto”.
Before we leave CompassPlot, let’s explore Native American cuisine by using the Wolfram Language to visualize the macronutrient profile of blue cornmeal:
Even better, Wolfram|Alpha can give you an image of piki, the traditional bread of the Hopi made with blue cornmeal:
Nutritional and Multidimensional
Just as foods are multidimensional — sweet, sour, salty, bitter and/or spicy — so is food data in Wolfram|Alpha.
Use the following Wolfram Language code to create a 3D graphic of the relative carbohydrate, protein and fiber content of a wide variety of crackers. Then, in a Wolfram Notebook, hover over the data points to find your favorite ones in the plot:
Eat Healthy and Be Happy
I hope you enjoy celebrating food and National Nutrition Month via the Wolfram Language as much as I do, and bon appétit!