Libraries & Dataset
We will start by importing the necessary libraries and loading the dataset.
Since bubble plots requires numerical values, we need to have quantitative data in our dataset.
| 0.487913 | 0.640856 | 0.685197 |
| 0.904584 | 0.029056 | 0.289917 |
| 0.186066 | 0.909341 | 0.576339 |
| 0.560585 | 0.119788 | 0.857088 |
| 0.335864 | 0.779507 | 0.092400 |
Bubble plot
A bubble plot is very similar to a scatterplot. Using matplotlib library, a bubble plot can be constructed using the scatter() function. In the example, the following parameters are used:
- x : The data position on the x axis
- y : The data position on the y axis
- s : The marker size
- alpha : Transparancy ratio
Going further
You might be interested in:
- how to change colors, shape and size of the bubbles
- how to map bubble colors with a 4th variable