
What is a Bubble Chart ?
A Bubble Chart is a type of scatter plot where each point is represented by a bubble, and the size of the bubble represents a third data dimension.
A bubble chart is a type of chart that extends the concept of a scatter plot by adding a third dimension represented by the size of the bubbles. Essentially, it allows you to visualize relationships between three numerical variables: two represented by the X and Y coordinates, and the third by the size of the bubble.
Visualizing Three Dimensions:
Bubble charts are used when you need to represent three distinct sets of numerical data simultaneously.
Bubble Size as the Third Dimension:
Unlike a scatter plot where points are plotted based on X and Y coordinates, in a bubble chart, the size of each bubble corresponds to the value of the third variable.
Example:
If you were visualizing sales data, you could plot the number of sales on the X-axis, the revenue on the Y-axis, and the number of items sold as the bubble size.
Comparison to Scatter Plots:
Bubble charts are essentially scatter plots with an added dimension represented by the bubble's size.
Applications:
Bubble charts are useful for analyzing relationships between multiple variables, identifying trends, and making comparisons within datasets.
Use Cases:
- Financial data (profit, growth, size)
- Survey analysis
- Population studies
- Performance comparison across 3 variables
Bubble Chart Example
<canvas id="myBubbleChart" width="400" height="300"></canvas>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myBubbleChart').getContext('2d');
const myBubbleChart = new Chart(ctx, {
type: 'bubble',
data: {
datasets: [
{
label: 'Company A',
data: [{ x: 10, y: 20, r: 15 }],
backgroundColor: 'rgba(255, 99, 132, 0.6)'
},
{
label: 'Company B',
data: [{ x: 25, y: 10, r: 10 }],
backgroundColor: 'rgba(54, 162, 235, 0.6)'
},
{
label: 'Company C',
data: [{ x: 15, y: 30, r: 20 }],
backgroundColor: 'rgba(255, 206, 86, 0.6)'
}
]
},
options: {
responsive: true,
scales: {
x: { beginAtZero: true },
y: { beginAtZero: true }
}
}
});
</script>
Comments
Add new comment