Linear Regression - Scatter Plot

Hello,

I have a question regarding the first scatter plots in the Linear Regression section
https://app.dataquest.io/m/235/the-linear-regression-model/3/simple-linear-regression

I believe my code is correct (the images also resemble those from the answer), however I get an error. Could someone please explain me what is the difference between my scatter plot definition and the one provided in the answer?

My Code:

ax1.scatter(train['Garage Area'],train['SalePrice'])
ax2.scatter(train['Gr Liv Area'],train['SalePrice'])
ax3.scatter(train['Overall Cond'],train['SalePrice'])

CORRECT CODE:

train.plot(x="Garage Area", y="SalePrice", ax=ax1, kind="scatter")
train.plot(x="Gr Liv Area", y="SalePrice", ax=ax2, kind="scatter")
train.plot(x="Overall Cond", y="SalePrice", ax=ax3, kind="scatter")

Thank you very much
Regards
Daniel Burnier

2 Likes

Hey, Burnier.

I don’t know much about our answer checking for plots, but I think it has something to do some properties of the objects that might be created differently from the way you solved this.

I’ll bring this up with the team. Your solution is correct as far as I’m concerned.

2 Likes