python-igraph API reference

List of all classes, functions and methods in python-igraph

class documentation

class RainbowPalette(Palette):

View In Hierarchy

A palette that varies the hue of the colors along a scale.

Colors in a rainbow palette all have the same saturation, value and alpha components, while the hue is varied between two given extremes linearly. This palette has the advantage that it wraps around nicely if the hue is varied between zero and one (which is the default).

Example:

>>> pal = RainbowPalette(n=120)
>>> pal.get(0)
(1.0, 0.0, 0.0, 1.0)
>>> pal.get(20)
(1.0, 1.0, 0.0, 1.0)
>>> pal.get(40)
(0.0, 1.0, 0.0, 1.0)
>>> pal = RainbowPalette(n=120, s=1, v=0.5, alpha=0.75)
>>> pal.get(60)
(0.0, 0.5, 0.5, 0.75)
>>> pal.get(80)
(0.0, 0.0, 0.5, 0.75)
>>> pal.get(100)
(0.5, 0.0, 0.5, 0.75)
>>> pal = RainbowPalette(n=120)
>>> pal2 = RainbowPalette(n=120, start=0.5, end=0.5)
>>> pal.get(60) == pal2.get(0)
True
>>> pal.get(90) == pal2.get(30)
True

This palette was modeled after the rainbow command of R.

Method __init__ Creates a rainbow palette.
Method _get Returns the color corresponding to the given color index.
Instance Variable _alpha Undocumented
Instance Variable _dh Undocumented
Instance Variable _s Undocumented
Instance Variable _start Undocumented
Instance Variable _v Undocumented

Inherited from Palette:

Method __len__ Returns the number of colors in this palette
Method __plot__ Plots the colors of the palette on the given Cairo context
Method __repr__ Undocumented
Method clear_cache Clears the result cache.
Method get Returns the given color from the palette.
Method get_many Returns multiple colors from the palette.
Property length Returns the number of colors in this palette
Instance Variable _cache Undocumented
Instance Variable _length Undocumented
def __init__(self, n=256, s=1, v=1, start=0, end=1, alpha=1):

Creates a rainbow palette.

Parameters
nthe number of colors in the palette.
sthe saturation of the colors in the palette.
vthe value component of the colors in the palette.
startthe hue at which the rainbow begins (between 0 and 1).
endthe hue at which the rainbow ends (between 0 and 1).
alphathe alpha component of the colors in the palette.
def _get(self, v):

Returns the color corresponding to the given color index.

Parameters
vnumerical index of the color to be retrieved
Returns
a 4-tuple containing the RGBA values
_alpha =

Undocumented

_dh =

Undocumented

_s =

Undocumented

_start =

Undocumented

_v =

Undocumented