Joint Plots

Learn to plot, design, and interpret joint plots for data visualizations.

We'll cover the following...

Overview

A joint plot allows us to see the relationship between two variables and the distribution of the variables together. It combines bivariate and univariate graphs in a single plot.

Plotting joint plots

To get started, we import the required libraries and storing the mpg dataset in the DataFrame mpg_df (after removing the null values). Let’s draw a joint plot for the horsepower and mpg variables using the sns.jointplot() function. A joint plot plots a relational plot as the main plot and a distribution plot along the axis.

Press + to interact
sns.jointplot( x= 'horsepower', y= 'mpg', data = mpg_df)
plt.savefig('output/graph.png')

We can observe from the plot above that as the horsepower increases, we see a decrease in mpg. This results in a negative correlation between mpg and horsepower. Similarly, on the x-axis, we see the horsepower marginal distribution represented in histograms. We ...