Max Jiang wrote:
> Hi all, I've had a lot of help from this newsgroup since I started
> using Matlab in August. I really appreciate people who give others
> invaluable advice and hopefully I would be able to do so one day.
> Anyway, I have another problem here:-)
> I'm plotting a scattered graph with markers only no lines. I know how
> to specify the colours of the markers but what if I need to change
> the colours according to their distance to a certain point. It's like
> the contour graph but with only markers instead. Hope I made my case
> clear. Any ideas?
All you are after is a function that computes distance from one point to
another. You can then use this value to assign colours.
Check the range of values that you get. Normalise the values so that they
lies within 0 and 1 and then define colour to be a tuple (x,x,x) where x is
a normalised value. This will give you shades of grey.
To calculate distance, see for example, Mahalanobis distance. There are very
simple formulations for point-to-point distance.