title: Matplotlib - plot with a different color for certain data points
body: <p>My question is similar to <a href="https://stackoverflow.com/questions/7881994/matplotlib-how-to-change-data-points-color-based-on-some-variable">this question</a>. I am plotting latitude vs longitude. If the value in a variable is 0, I want that lat/long value to be marked with a different color. How do I do that?</p>
  
  <p>This is my attempt at it so far. Here x holds the latitude and y holds longitude. timeDiff is a list holding float values and if the value is 0.0, I want that color to be different.</p>
  
  <p>Since, matplotlib complained that it cannot use floats, I first converted the values to int.</p>
  
  <pre><code>timeDiffInt=[int(i) for i in timeDiff]
  </code></pre>
  
  <p>Then I used list comprehension:</p>
  
  <pre><code>plt.scatter(x,y,c=[timeDiffInt[a] for a in timeDiffInt],marker='&lt;')
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>IndexError: list index out of range
  </code></pre>
  
  <p>So I checked the lengths of x, y and timeDiffInt. All of them are the same. Can someone please help me with this? Thanks.</p>