pwtools.mpl.smooth_color_func

pwtools.mpl.smooth_color_func(niter, func)[source]

Version of smooth_color() that accepts a function.

Can be used to pre-calculate a color list outside of a loop.

Parameters:
  • niter (int) – number of iterations

  • func (callable)

Examples

>>> from pwtools import mpl
>>> mpl.smooth_color_func(3, lambda z: (z,0,1-z))
[(0.0, 0, 1.0), (0.5, 0, 0.5), (1.0, 0, 0.0)]
>>> for ii,color in enumerate(mpl.smooth_color_func(10, lambda z: (z,0,1-z))):
...     plot(rand(20)+ii, color=color)