title: Python Scatterplot: Changing color based on both X and Y values
body: <p>I've tried to recreate the image attached using cmaps as well as with if/else statements.</p>
  
  <p><img src="https://i.stack.imgur.com/uVVMU.png" alt="Example"></p>
  
  <p>My current attempt is based upon the advice given in <a href="https://stackoverflow.com/questions/40803570/python-matplotlib-scatter-plot-specify-color-points-depending-on-conditions/40804861">this thread</a></p>
  
  <p>I tried using 1.8&lt;=x&lt;=2.2 but I get an error.</p>
  
  <p>Here is my current code below:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  N = 500
  # center, variation, number of points
  x = np.random.normal(2,0.2,N)
  y = np.random.normal(2,0.2,N)
  colors = np.where(x&lt;=2.2,'r',np.where(y&lt;=2.2,'b','b'))
  plt.scatter(x , y, c=colors)
  plt.colorbar()
  plt.show()
  </code></pre>