Create a Bubble Chart with Matplotlib
📖 Scenario: You work as a data analyst for a small company. Your manager wants to see a visual comparison of sales data for different products. You will create a bubble chart to show the sales volume, profit, and number of customers for each product.
🎯 Goal: Build a bubble chart using matplotlib that shows product sales data. The x-axis will represent sales volume, the y-axis will represent profit, and the size of each bubble will represent the number of customers.
📋 What You'll Learn
Create a dictionary called
sales_data with product names as keys and tuples of (sales volume, profit, customers) as values.Create a variable called
scale_factor to adjust bubble sizes.Use a
for loop with variables product and values to iterate over sales_data.items().Plot bubbles using
plt.scatter with correct x, y, and size values.Add labels for x-axis, y-axis, and a title.
Print the plot using
plt.show().💡 Why This Matters
🌍 Real World
Bubble charts help businesses visualize relationships between three variables at once, such as sales, profit, and customer count.
💼 Career
Data analysts and scientists use bubble charts to present complex data clearly to managers and stakeholders.
Progress0 / 4 steps