Last answered:

26 Nov 2022

Posted on:

26 Nov 2022

1

Resolved: Seaborn scatterplot

I am sorry, i am confused, how you got scatter plot with the price on the "y axis" when you used and specified that price is on the "x axis"
while writing the code with seaborn library ? could you please explain the logic behind?
Thanks

1 answers ( 1 marked as helpful)
Posted on:

26 Nov 2022

3

Hi Abdelrahman,

I believe the video just has the labels/arguments mismatched in the seaborn example.

In the first example, doing the scatter plot with matplotlib, the x-axis is Area, and the y-axis is Price, with the labels corresponding to the same.

For the second example, doing the scatter plot with seaborn, the x-axis is Price, and the y-axis is Area. However, since the labels were copy-pasted from the first example, the axis labels corresponded to the wrong axis. This can be seen with the data colors & axis seeming to look "flipped" from the first example:

image.png

image.png
image



So for the seaborn plot, you can either change the labels or change the arguments.
Option 1: Changing the labels--just having the x label correspond to price and y label correspond to area
image.png

Option 2: Changing the arguments
- You can just add the "x =" and "y =" to get the axes properly, or you can rearrange the first two parameters so they're in the right order of x, then y
image.png

Let me know if that helps or if there's anything that isn't clear. Cheers!

Submit an answer