My question is similar to this question. 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?
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.
Since, matplotlib complained that it cannot use floats, I first converted the values to int.
timeDiffInt=[int(i) for i in timeDiff]
Then I used list comprehension:
plt.scatter(x,y,c=[timeDiffInt[a] for a in timeDiffInt],marker='<')
But I get this error:
IndexError: list index out of range
So I checked the lengths of x, y and timeDiffInt. All of them are the same. Can someone please help me with this? Thanks.