Xiaolei wrote:
> I'm trying to plot some points in an image. Each point has an
> associating type and I'd like to have different colors (preferrably of
> high contrast) for different types. The number of types in the data
> file is unknown a priori. Is there a way to do this at runtime?
How about:
from colorsys import hsv_to_rgb
def colors(n):
incr = 1.0 / n
hue = 0.0
for i in xrange(n):
r, g, b = hsv_to_rgb(hue, 1.0, 1.0)
yield int(r*255), int(g*255), int(b*255)
hue += incr
--
http://mail.python.org/mailman/listinfo/python-list