Common Cocktail Ingredient Pairings
A horizontal bar chart ranks the most frequent cocktail ingredients, with bar length scaled to ingredient counts and color encoding the primary alcohol type. The visualization is built with the Vega-Lite API, registered with Vega and Vega-Lite libraries, and processes a parsed CSV dataset of cocktails from Hotaling & Co. The chart supports filtering by up to five ingredients, dynamically rebuilding the title and bar ordering based on selected pairings, while tooltips display cocktail names. Users can adjust constants for ingredient filters and result count in the source code.
AI-generated descriptionA visualization constructed using the vega-lite-api.
This visualization is based on the dataset of cocktails collected by alcohol importer and distiller Hotaling & Co. The original dataset was modified to parse out and clean up the ingredients into rows.
The chart can be interactive if the user modifies the ingredient constants in the index.js file. The user can enter up to 5 ingredients to filter on. The chart will return all of the ingredients included in cocktails containing the selected ingredients.The user can also modify the nSlices constant in order to modify the number of results returned in the chart. The tooltip will show the cocktail names and the colors indicate the main alcohol contained in the cocktail.
In playing around with the visualization, I discovered the following:
- Without using any filters, you can see the top ingredients included in all cocktails. Not surprising that lemon and lime juice are at the top, but I was surprised to see marachino liqueur in 3rd place and ginger liquer in 4th place. I didn't realize these liquers were that popular.
- If you have specific ingredients on hand, you can filter on these to see what other ingredients to pair with these. For example, what goes well with egg whites? Based on this you can't go wrong pairing it with lemon juice, ginger liquer, simple syrup and gin.
**Note: I don't yet know how to get interactivity without modifying the code. It would be nice to learn about this :)