Package Bio :: Package Graphics :: Module ColorSpiral
[hide private]
[frames] | no frames]

Module ColorSpiral

source code

Generate RGB colours suitable for distinguishing categorical data.

This module provides a class that implements a spiral 'path' through HSV
colour space, permitting the selection of a number of points along that path,
and returning the output in RGB colour space, suitable for use with ReportLab
and other graphics packages.

This approach to colour choice was inspired by Bang Wong's Points of View
article: Color Coding, in Nature Methods _7_ 573 (doi:10.1038/nmeth0810-573).

The module also provides helper functions that return a list for colours, or
a dictionary of colours (if passed an iterable containing the names of
categories to be coloured).

Classes [hide private]
  ColorSpiral
Implement a spiral path through HSV colour space.
Functions [hide private]
 
get_colors(k, **kwargs)
Returns k colours selected by the ColorSpiral object, as a generator.
source code
 
get_color_dict(l, **kwargs)
Returns a dictionary of colours using the provided values as keys.
source code
Variables [hide private]
  __package__ = 'Bio.Graphics'
Function Details [hide private]

get_colors(k, **kwargs)

source code 
Returns k colours selected by the ColorSpiral object, as a generator.

Arguments:

o k - the number of colours to return

o **kwargs - pass-through arguments to the ColorSpiral object

get_color_dict(l, **kwargs)

source code 
Returns a dictionary of colours using the provided values as keys.

Returns a dictionary, keyed by the members of iterable l, with a
colour assigned to each member.

Arguments:

o l - an iterable representing classes to be coloured

o **kwargs - pass-through arguments to the ColorSpiral object