title: How to put a legend inside a loop with one by one data point (or outside) in Python?
body: <p>In matplotlib, I am using a loop to plot a graph, with each step only plotting one data point (X[index], Y[index]) with a specific color C[index], so that it will assign a color to each point. In total, I use 8 colors to represent my data points, so I hope I can have a legend with these 8 colors and each one represents one meaning. </p>
  
  <p>This is my code. Thanks for help. : )</p>
  
  <pre><code>for index in range(0,len(X)):
    plt.plot(X[index],Y1[index], marker = 'o', markersize = 10, color = C[index])  
    plt.xlabel("the percentage of students' credit hours found in instructor data", fontsize=14, color ="blue")
    plt.ylabel("total number of writing assinments", fontsize=14, color="blue")
    plt.axis([0, 100, 0, max(Y1)]) 
  plt.show()
  </code></pre>