From 1076d35af3e6a49265f26b4f6d825e6f7d4d25b1 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Mon, 1 Apr 2019 17:45:39 +0100 Subject: [PATCH] Backport PR #13780: numpydoc ListedColormap parameters --- lib/matplotlib/colors.py | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index bfc53ada8654..623dcef85e84 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -745,35 +745,34 @@ def func_r(x): class ListedColormap(Colormap): - """Colormap object generated from a list of colors. + """ + Colormap object generated from a list of colors. This may be most useful when indexing directly into a colormap, but it can also be used to generate special colormaps for ordinary mapping. - """ - def __init__(self, colors, name='from_list', N=None): - """ - Make a colormap from a list of colors. - *colors* - a list of matplotlib color specifications, - or an equivalent Nx3 or Nx4 floating point array - (*N* rgb or rgba 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:: + Parameters + ---------- + colors : list, array + List of Matplotlib color specifications, or an equivalent Nx3 or Nx4 + floating point array (*N* rgb or rgba values). + name : str, optional + String to identify the colormap. + N : int, optional + 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) + N < len(colors) - the list will be truncated at *N*. If:: + the list will be truncated at *N*. If:: - N > len(colors) + N > len(colors) - the list will be extended by repetition. - """ + the list will be extended by repetition. + """ + def __init__(self, colors, name='from_list', N=None): self.monochrome = False # True only if all colors in map are # identical; needed for contouring. if N is None: