def __init__(self, colors, name = '<STR_LIT>', N = None):
self.colors = colors<EOL>self.monochrome = False  <EOL>if N is None:<EOL><INDENT>N = len(self.colors)<EOL><DEDENT>else:<EOL><INDENT>if cbook.is_string_like(self.colors):<EOL><INDENT>self.colors = [self.colors] * N<EOL>self.monochrome = True<EOL><DEDENT>elif cbook.iterable(self.colors):<EOL><INDENT>self.colors = list(self.colors) <EOL>if len(self.colors) == <NUM_LIT:1>:<EOL><INDENT>self.monochrome = True<EOL><DEDENT>if len(self.colors) < N:<EOL><INDENT>self.colors = list(self.colors) * N<EOL><DEDENT>del(self.colors[N:])<EOL><DEDENT>else:<EOL><INDENT>try: gray = float(self.colors)<EOL>except TypeError: pass<EOL>else:  self.colors = [gray] * N<EOL>self.monochrome = True<EOL><DEDENT><DEDENT>Colormap.__init__(self, name, N)<EOL>
Make a colormap from a list of colors.

*colors*
    a list of matplotlib color specifications,
    or an equivalent Nx3 floating point array (*N* rgb values)
*name*
    a string to identify the colormap
*N*
    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.