A bubble chart is basically a scatter plot with an additional dimension. The additional dimension helps in setting the size of the bubble, which means that the greater the size of the bubble, the larger the value that represents the bubble. This kind of a chart helps in analyzing the data of three dimensions.
The following code creates a sample data of three variables and this data is then fed to the
plot() method where its kind is mentioned as a scatter and s is the size of the bubble:
>>> plt.style.use('ggplot') >>> df = pd.DataFrame(np.random.rand(50, 3), columns=['a', 'b', 'c']) >>> df.plot(kind='scatter', x='a', y='b', s=df['c']*400);
After the preceding code is executed we'll get the following output: