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

Class GradientPalette

object --+    
         |    
   Palette --+
             |
            GradientPalette
Known Subclasses:

Base class for gradient palettes

Gradient palettes contain a gradient between two given colors.

Example:

>>> pal = GradientPalette("red", "blue",4)
>>> pal.get(2)
(0.5, 0., 0.5)
Instance Methods [hide private]
 
__init__(self, color1, color2, n=256)
Creates a 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, color1, color2, n=256)
(Constructor)

 

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)

 

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)