Package igraph :: Module colors :: Class AdvancedGradientPalette
[hide private]
[frames] | no frames]

Class AdvancedGradientPalette

 object --+        
          |        
    Palette --+    
              |    
GradientPalette --+
                  |
                 AdvancedGradientPalette

Advanced gradient that consists of more than two base colors.

Example:

>>> pal = AdvancedGradientPalette(["red", "black", "blue"], n=8)
>>> pal.get(2)
(0.5, 0., 0.)
>>> pal.get(7)
(0., 0., 0.75)
Instance Methods [hide private]
 
__init__(self, colors, indices=None, n=256)
Creates an advanced gradient palette
 
_get(self, v)
Override this method in a subclass to create a custom palette.

Inherited from Palette: __getitem__, __len__, clear_cache, get

Inherited from Palette (private): _get_length

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from Palette: length

Inherited from object: __class__

Method Details [hide private]

__init__(self, colors, indices=None, n=256)
(Constructor)

 

Creates an advanced gradient palette

Parameters:
  • colors - the colors in the gradient.
  • indices - the color indices belonging to the given colors. If None, the colors are distributed equally
  • n - the total number of colors in the palette
Overrides: object.__init__

_get(self, v)

 

Override this method in a subclass to create a custom palette.

You can safely assume that v is an integer in the range 0..n-1 where n is the size of the palette.

Parameters:
  • v - numerical index of the color to be retrieved
Returns:
a 3-tuple containing the RGB values
Overrides: Palette._get
(inherited documentation)