Home | Trees | Indices | Help |
|
---|
|
object --+ | Palette
Base class of color palettes.
Color palettes are mappings that assign integers from the range 0..n-1 to colors (3-tuples). n is
called the size or length of the palette. igraph
comes with
a number of predefined palettes, so this class is useful for you only if
you want to define your own palette. This can be done by subclassing this
class and implementing the Palette._get method as necessary.
Palettes can also be used as lists or dicts, for the
__getitem__
method is overridden properly to call Palette.get.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
length | |||
Inherited from |
|
Returns the given color from the palette. Values are cached: if the specific value given has already been looked upon, its value will be returned from the cache instead of calculating it again. Use Palette.clear_cache to clear the cache if necessary.
Note: you shouldn't override this method in subclasses, override _get instead. If you override this method, lookups in the known_colors dict won't work, so you won't be able to refer to colors by names or RGB triplets, only by integer indices. The caching functionality will disappear as well. However, feel free to override this method if this is exactly the behaviour you want. |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
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.
|
Clears the result cache. The return values of Palette.get are cached. Use this method to clear the cache. |
Returns the given color from the palette. Values are cached: if the specific value given has already been looked upon, its value will be returned from the cache instead of calculating it again. Use Palette.clear_cache to clear the cache if necessary.
Note: you shouldn't override this method in subclasses, override _get instead. If you override this method, lookups in the known_colors dict won't work, so you won't be able to refer to colors by names or RGB triplets, only by integer indices. The caching functionality will disappear as well. However, feel free to override this method if this is exactly the behaviour you want. |
|
length
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Aug 16 21:30:47 2008 | http://epydoc.sourceforge.net |