March 2020
Beginner to intermediate
352 pages
8h 40m
English
A bubble plot is a manifestation of the scatter plot where each data point on the graph is shown as a bubble. Each bubble can be illustrated with a different color, size, and appearance.
Let 's continue using the Iris dataset to get a bubble plot. Here, the important thing to note is that we are still going to use the plt.scatter method to draw a bubble chart:
# Load the Iris datasetdf = sns.load_dataset('iris')df['species'] = df['species'].map({'setosa': 0, "versicolor": 1, "virginica": 2})# Create bubble plotplt.scatter(df.petal_length, df.petal_width, s=50*df.petal_length*df.petal_width, c=df.species, alpha=0.3 )# Create labels for axisesplt.xlabel('Septal Length')plt.ylabel('Petal length')plt.show()
The bubble chart generated ...
Read now
Unlock full access