|
From: <ef...@us...> - 2008-04-12 18:48:39
|
Revision: 5040
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5040&view=rev
Author: efiring
Date: 2008-04-12 11:48:37 -0700 (Sat, 12 Apr 2008)
Log Message:
-----------
Bugfix and docstring addition for ListedColormap
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2008-04-11 15:32:03 UTC (rev 5039)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2008-04-12 18:48:37 UTC (rev 5040)
@@ -530,6 +530,15 @@
"""
def __init__(self, colors, name = 'from_list', N = None):
"""
+ Make a colormap from a list of colors.
+
+ colors is a list of matplotlib color specifications
+ name is a string to identify the colormap
+ N is the number of entries in the map. The default is None,
+ in which case there is one colormap entry for each
+ element in the list of colors. If N < len(colors)
+ the list will be truncated at N. If N > len(colors),
+ the list will be extended by repetition.
"""
self.colors = colors
self.monochrome = False # True only if all colors in map are identical;
@@ -545,7 +554,7 @@
self.monochrome = True
if len(self.colors) < N:
self.colors = list(self.colors) * N
- del(self.colors[N:])
+ del(self.colors[N:])
else:
try: gray = float(self.colors)
except TypeError: pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|