Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: how to change colours according to the distance?

  • Subject: Re: how to change colours according to the distance?
  • From: Roy Schestowitz <newsgroups@schestowitz.com>
  • Date: Wed, 08 Dec 2004 06:41:34 +0000
  • Newsgroups: comp.soft-sys.matlab
  • References: <eef55e3.-1@webx.raydaftYaTP>
  • User-agent: KNode/0.7.2
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?

Max,

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.

Roy

-- 
Roy Schestowitz
http://schestowitz.com

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index