python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph :: Package drawing :: Module colors :: Class GradientPalette
[hide private]

Class GradientPalette

source code

object --+    
         |    
   Palette --+
             |
            GradientPalette

Base class for gradient palettes

Gradient palettes contain a gradient between two given colors.

Example:

>>> pal = GradientPalette("red", "blue", 5)
>>> pal.get(0)
(1.0, 0.0, 0.0, 1.0)
>>> pal.get(2)
(0.5, 0.0, 0.5, 1.0)
>>> pal.get(4)
(0.0, 0.0, 1.0, 1.0)
Instance Methods [hide private]
 
__init__(self, color1, color2, n=256)
Creates a gradient palette.
source code
 
_get(self, v)
Returns the color corresponding to the given color index.
source code

Inherited from Palette: __getitem__, __len__, __plot__, __repr__, clear_cache, get, get_many

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from Palette: length

Inherited from object: __class__

Method Details [hide private]

__init__(self, color1, color2, n=256)
(Constructor)

source code 

Creates a gradient palette.

Parameters:
  • color1 - the color where the gradient starts.
  • color2 - the color where the gradient ends.
  • n - the number of colors in the palette.
Overrides: object.__init__

_get(self, v)

source code 

Returns the color corresponding to the given color index.

Parameters:
  • v - numerical index of the color to be retrieved
Returns:
a 4-tuple containing the RGBA values
Overrides: Palette._get

   Home       Trees       Indices       Help