title: No handles with labels found to put in legend. plt.legend()
body: <p>I just learned python, this is literally my first lesson and i was told to make kmeans with python. and while i was doing in and it gives me an error when i use plt.legend() i have read in sov that we should use ax.legend but apparently either it didn't work or i wrote it wrong. so i thought i'll just gave the code before i changed it to the ax. my english is not very good so please bear with it. thank you</p>
  <pre><code>import numpy as np
  import pandas as pd
  from sklearn.cluster import KMeans
  from sklearn.preprocessing import MinMaxScaler
  import matplotlib.pyplot as plt
  import seaborn as sns
  df = pd.read_excel(&quot;Umur.xlsx&quot;)
  df.head()
  print(df)
  a = plt.scatter(df['Umur'],df['Gaji'])
  plt.show()
  km = KMeans(n_clusters=3)
  km
  y_predicted = km.fit_predict(df[['Umur','Gaji']])
  y_predicted
  print(y_predicted)
  df['cluster'] = y_predicted
  df.head()
  print(df)
  
  df1 = df[df.cluster==0]
  df2 = df[df.cluster==1]
  df3 = df[df.cluster==2]
  
  plt.scatter(df1.Umur,df1['Gaji'],color='green')
  plt.scatter(df2.Umur,df2['Gaji'],color='red')
  plt.scatter(df3.Umur,df3['Gaji'],color='black')
  
  #plt.scatter(km.cluster_centers_[:,0],km_clusters_centers_[:,1],color='purple',marker='*',label='centroid')
  plt.xlabel('Umur')
  plt.ylabel('Gaji')
  plt.legend ()
  </code></pre>