title: 2D colormap in Python
body: <p>I have a 2d vector <code>(x,y)</code> and I need to find a 2D colormap that maps these coordinates to a smooth colormap. The color code will depend only on the <code>(x,y)</code> value. For instance, </p>
  
  <ul>
  <li>white around the center, </li>
  <li>more red as we go to the northeast, </li>
  <li>more blue as we go the southeast, </li>
  <li>more green as we go to the northwest, </li>
  <li>and more green as we go to the southwest.</li>
  </ul>
  
  <p>In other words:</p>
  
  <pre><code>green         red
         white
  green         blue
  </code></pre>
  
  <p>I didn't find anything in <code>matplotlib</code> correspond to my need. I thought about converting the coordinates into magnitude and phase but still the problem be the same. I also thought about adding a dummy dimension to the vector <code>(x,y)</code> to make it a 3d dimension and then normalize the resulted 3D vector. Then, feed it to <code>cmap</code> parameter in the <code>matplotlib</code> plots. However, this would produce a non-smooth colors. Any leads?</p>
  
  <p>A sample of the color map:</p>
  
  <p><a href="https://i.stack.imgur.com/aWLbt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aWLbt.png" alt="sample color map"></a></p>