[gameprogrammer] Re: mapping numbers to colors
- From: Stephane Marchesin <stephane.marchesin@xxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Thu, 02 Dec 2004 23:08:14 +0100
Alan Wolfe wrote:
>Hey guys,
>wierd question, possibly straight out of the old school days...
>
>I'm making some line graphs and i have X number of groups of data.
>
>X could be 1 or it could be 20, it varies.
>
>What im trying to do is come up with a good way to automaticly set colors to
>these groups of data.
>
>ie if there were 2 groups, 1 line could be red and the 2nd line could be blue.
>
>if there were 4 groups, i could use red, blue, yellow, green for the lines etc.
>
>Does anyone know a way to algorithmicly come up with X number of colors, that
>are as far apart visualy as possible? Cause if theres 5 groups of data and
>they are all shades of blue, thats not very good.
>
Here's what I usually do (probably not the best way but whatever) :
I'm coloring objects that are subsequently drawn in 3d and shaded. Thus
I only want to set the raw color, not the shades.
After a first pass to know how many groups I have, I work in the HSV
color space, and take a number of points (equal to the number of groups)
regularly spaced around H axis, and take S=1 and V=1.
Then, I convert the color from HSV space to RGB space for each of these
points and that's the color for the corresponding
object/data/cluster/class/whatever. And that's all.
Stephane
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: mapping numbers to colors
- From: Alan Wolfe
- [gameprogrammer] This List has been quite... so
- From: Jake The Snake Briggs
- References:
- [gameprogrammer] mapping numbers to colors
- From: Alan Wolfe
Other related posts:
- » [gameprogrammer] mapping numbers to colors
- » [gameprogrammer] Re: mapping numbers to colors
- » [gameprogrammer] Re: mapping numbers to colors
- » [gameprogrammer] Re: mapping numbers to colors
- » [gameprogrammer] Re: mapping numbers to colors
- » [gameprogrammer] Re: mapping numbers to colors
- » [gameprogrammer] Re: mapping numbers to colors
- [gameprogrammer] Re: mapping numbers to colors
- From: Alan Wolfe
- [gameprogrammer] This List has been quite... so
- From: Jake The Snake Briggs
- [gameprogrammer] mapping numbers to colors
- From: Alan Wolfe