Module colors
[frames] | no frames]

Module colors

Utility procedures for manipulating colors

Functions
 
HSVtoRGB(h, s, v)
Convert a color represented in hue, saturation, value space into RGB space.
 
probToPyColor(p, uniformP=0.5, upperVal=None)
Converts a probability to a Python color.
 
probToMapColor(p, hue=60.0)
Returns: a Python color that's good for mapmaking.
 
rootToPyColor(p, minV, maxV)
Color map for making root-locus plots
 
RGBToPyColor(colorVals)
Returns: a python color string
 
safeLog(v)
Log, but it returns -1000 for arguments less than or equal to 0.
Variables
  redHue = 0.0
  greenHue = 120.0
  blueHue = 240.0
  yellowHue = 60.0
  __package__ = None
Function Details

HSVtoRGB(h, s, v)

 

Convert a color represented in hue, saturation, value space into RGB space.

Parameters:
  • h - hue, in range (0, 360)
  • s - saturation, in range (0, 1)
  • v - value, in range (0, 1)
Returns:
(r, g, b) with each value in the range (0, 1)

probToPyColor(p, uniformP=0.5, upperVal=None)

 

Converts a probability to a Python color. Probability equal to uniform converts to black. Closer to 1 is brighter blue; closer to 0 is brighter red.

Parameters:
  • p - probability value in range (0, 1)
  • uniformP - probability value that will be colored black
  • upperVal - in situations when there are lots of choices and so the highest reasonable value to occur is nowhere near 1, it can be useful to set this to the highest probability value you expect, in order to get some useful visual dynamic range.
Returns:
A Python color

probToMapColor(p, hue=60.0)

 
Parameters:
  • p - probability value
Returns:
a Python color that's good for mapmaking. It's yellow when p = 0.5, black when p = 1, white when p = 1.

RGBToPyColor(colorVals)

 
Parameters:
  • colorVals - tuple (r, g, b) of values in (0, 1) representing a color in rgb space
Returns:
a python color string