Visualizing Spice & Herb Networks Across Cuisines
May 2024
Have you ever wondered what ingredients are used the most often across all of the world’s cuisines? This project visualizes the co-occurrence of spices and herbs as found in a selection of recipes classified by cuisine from Allrecipes.com.
Radial network graph illustrating spice pairings found in the dataset.
The data for this project was collected using a Python script that scraped the ingredient lists of 2,173 recipes. After extensive data filtering, reconciliation, and classification, I was left with 108 unique spices and herbs that are included in the following analysis. You can read more about my methodology here.
Network created in Gephi. Click to see labels.
How to Read These Visualizations
Each point on the network represents an individual spice or herb. Two points are connected when they were included in a recipe together. Points are sized according to their degree, or how many other points to which they are connected. The larger the circle, the more connections the ingredient has. For instance, black pepper has a degree of 89, meaning it has been used in recipes alongside 89 other spices and herbs.
The layout of the network was arranged based on the Yifan-Hu Proportional algorithm, which pushes points that are most central to the network to the middle of the graph. This means that these spices and herbs most frequently act as bridges between other spices. That is why black pepper is in the middle of the network. Points on the outside of the graph, such as pandan and Sichuan peppercorn are used less widely across the network.
Finally, to study how various spices are used across cuisines, I utilized Gephi’s algorithm for detecting communities within the network. Each color on the graph represents one of these communities. A community indicates that certain spices and herbs are used together most frequently. For instance, Group 2 is primarily fresh, green herbs such as parsley, oregano, thyme, and bay leaf.
These are the groups detected in the network, ordered by the number of instances they were used in a recipe:
Spice & Herb Usage Across Cuisines
Using these color-coded spice groups, I then visualized their presence within each cuisine’s recipes using small multiple pie charts. This enables us to study how each of these cuisines are shaped by these various spices and herbs, and explore how they compare to each other.
The following dashboard allows you to explore what spices are used in each cuisine. I recommend selecting a maximum of 4 cuisines.
Hint: To reset your selections, select and deselect the “All” option.
A Note About Data Limitations
Ultimately, this dataset represents a minuscule portion of the world’s cuisine, and it is important to remember that the authors of these recipes comprise a small section of the world’s voices when it comes to food. There are striking gaps in the data. For instance, there is no category for Mexican food, yet one for Tex-Mex exists. There is also no category for American food. Is this because Allrecipes assumes this is the assumed, “neutral” cuisine? Food is messy and naturally defies categorization. My classification of this data comes from my own understanding and biases around food. Small changes to it may drastically affect the shape of the network.