biopython v1.71.0 Bio.Graphics.ColorSpiral

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).

Link to this section Summary

Functions

Return a dictionary of colours using the provided values as keys

Return k colours selected by the ColorSpiral object, as a generator

Link to this section Functions

Link to this function get_color_dict()

Return 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:

  • l - an iterable representing classes to be coloured
  • kwargs - pass-through arguments to the ColorSpiral object

Return k colours selected by the ColorSpiral object, as a generator.

Arguments:

  • k - the number of colours to return
  • kwargs - pass-through arguments to the ColorSpiral object