biopython v1.71.0 Bio.Graphics.ColorSpiral.ColorSpiral
Implement a spiral path through HSV colour space.
This class provides functions for sampling points along a logarithmic spiral path through HSV colour space.
The spiral is described by r = a exp(b t) where r is the distance from the axis of the HSV cylinder to the current point in the spiral, and t is the angle through which the spiral has turned to reach the current point. a and b are (positive, real) parameters that control the shape of the spiral.
- a: the starting direction of the spiral
- b: the number of revolutions about the axis made by the spiral
We permit the spiral to move along the cylinder (‘in V-space’) between v_init and v_final, to give a gradation in V (essentially, brightness), along the path, where v_init, v_final are in [0,1].
A brightness ‘jitter’ may also be provided as an absolute value in V-space, to aid in distinguishing consecutive colour points on the path.
Link to this section Summary
Initialize a logarithmic spiral path through HSV colour space
Generate k different RBG colours evenly-space on the spiral
Link to this section Functions
Initialize a logarithmic spiral path through HSV colour space.
- a - Parameter a for the spiral, controls the initial spiral direction. a > 0
- b - parameter b for the spiral, controls the rate at which the spiral revolves around the axis. b > 0
- v_init - initial value of V (brightness) for the spiral. v_init in [0,1]
- v_final - final value of V (brightness) for the spiral v_final in [0,1]
- jitter - the degree of V (brightness) jitter to add to each selected colour. The amount of jitter will be selected from a uniform random distribution [-jitter, jitter], and V will be maintained in [0,1].
Generate k different RBG colours evenly-space on the spiral.
A generator returning the RGB colour space values for k evenly-spaced points along the defined spiral in HSV space.
- k - the number of points to return
- offset - how far along the spiral path to start.