Solution Review: Visualizing Auto MPG Dataset
This lesson provides the solutions to the previous challenges.
We'll cover the following...
We'll cover the following...
Scatter plot #
According to the problem statement, we need to find the relationship between acceleration and displacement. To plot a visualization, we import seaborn module at line 2. Before doing it, we have to read the data first. There’s no need to explain how to read the data, as we studied that in detail previously. Dataset is read from line 5 to line 10.
Moving towards the main implementation, look at the header of the scatter_plot(df) function at line 13. It takes one arguments as input:
df: A dataframe containing the dataset in the form of a matrix.
Line 14 is the most important line. We are using a built-in function lmplot from seaborn library which takes three main argument:
x: Column whose values are to plotted at the x-axisy: Column whose values are to plotted at the y-axisdata: Dataframe containing data in the form of a matrix
We set displacement as x and ...