Search⌘ K

Scatter, Area, and Stacked Bar Plots

Explore techniques to create scatter plots, area plots, and stacked bar charts using pandas. Understand how to examine relationships between numeric columns, visualize data distribution, and effectively present data contributions with these plotting methods.

Scatter plots

A scatter plot is useful to determine the relationship between two columns that are numeric. We can evaluate what tends to happen to one value as the other value changes. Here is a scatter plot to examine the relationship between Integrity and Avoid_crucial_mistakes:

Python 3.8
(pres
.plot.scatter(x='Integrity', y='Avoid_crucial_mistakes')
)

It appears that as the rank for integrity falls, so does the rank for avoiding crucial mistakes. Indeed, the Pearson correlation coefficient also seems to indicate this:

Python 3.8
print(pres.Integrity.corr(pres.Avoid_crucial_mistakes))

Let’s add other ...