Last answered:

22 Nov 2023

Posted on:

12 Jan 2023

0

Unable to plot the scatter plot getting the below error.

Hello there,

I am getting the below error while trying to plot the scatter one.

Could you please help me on this?

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/87/b8_h63x54yn0w42lxrt4xlww0000gn/T/ipykernel_2177/2920882574.py in <module>
      2 y_axis = df_segm_kmeans['Income']
      3 plt.figure(figsize = (10, 8))
----> 4 sns.scatterplot(x_axis, y_axis, hue = df_segm_kmeans['Labels'], palette = ['g', 'r', 'c', 'm'])
      5 plt.title('Segmentation K-means')
      6 plt.show()

TypeError: scatterplot() takes from 0 to 1 positional arguments but 2 positional arguments (and 2 keyword-only arguments) were given


<Figure size 1000x800 with 0 Axes>



Thanks and Regards,
Siva

2 answers ( 0 marked as helpful)
Instructor
Posted on:

30 Jan 2023

0

Hi Packiarajan,
thanks for reaching out! In order to troubleshoot the problem, can you include the code cell which causes the error? Thanks in advance!

Best,
365 Eli

Posted on:

22 Nov 2023

0

Hi there,

maybe this one is already solved, in the case that not that fix worked for me.


try to add x= and y= to initilize the arguments.


4 sns.scatterplot(x = x_axis, y = y_axis, hue = df_segm_kmeans['Labels'], palette = ['g', 'r', 'c', 'm'])


hope it helps :)

Submit an answer