title: Scatterplot problem in changing points color with if function
body: <p>I am new to python, and I am trying to plot some points with different colours. The colour of the points should be decided by a value of the point itself</p>
  
  <p>The dataset is a 3 dimensional matrix, the first two dimension are used for plotting, while the 3rd one is the classification. The points should have different colours based on the classification.</p>
  
  <p>I am using a for loop with an if inside.
  Somehow it behaves like all the classification value is -1, printing all the points with that colour, despite printing the value correctly.</p>
  
  <pre><code>import numpy as np
  import math
  import matplotlib.pyplot as plt
  
  p = 10
  
  datacord = np.array([[1,1,1],[1,2,1],[2,2,1],[1,3,1],[2,3,1],[5,5,-1],[5,6,-1],[6,5,-1],[7,6,-1],[7,7,-1]])
  xaxis = datacord[:,0]
  yaxis = datacord[:,1]
  dataclass = datacord[:,2]
  
  for f in range (p):   
      if dataclass[f] &gt; 0:
          plt.scatter(xaxis, yaxis, color="blue")
          print(dataclass[f])
      else:
          plt.scatter(xaxis, yaxis, color="red")
          print(dataclass[f])
  
  plt.axis([-1, 10, -1, 10])
  plt.show()
  </code></pre>
  
  <p>I would like to understand why the colours does not changes, but are all the same.
  I expect the first 5 points to be coloured in blue, while the other 5 to be coloured in red</p>
  
  <p>Thank you in advance.</p>