8000 Backport PR #13780: numpydoc ListedColormap parameters · matplotlib/matplotlib@1076d35 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1076d35

Browse files
dstansbyMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #13780: numpydoc ListedColormap parameters
1 parent 22faca3 commit 1076d35

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

lib/matplotlib/colors.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -745,35 +745,34 @@ def func_r(x):
745745

746746

747747
class ListedColormap(Colormap):
748-
"""Colormap object generated from a list of colors.
748+
"""
749+
Colormap object generated from a list of colors.
749750
750751
This may be most useful when indexing directly into a colormap,
751752
but it can also be used to generate special colormaps for ordinary
752753
mapping.
753-
"""
754-
def __init__(self, colors, name='from_list', N=None):
755-
"""
756-
Make a colormap from a list of colors.
757754
758-
*colors*
759-
a list of matplotlib color specifications,
760-
or an equivalent Nx3 or Nx4 floating point array
761-
(*N* rgb or rgba values)
762-
*name*
763-
a string to identify the colormap
764-
*N*
765-
the number of entries in the map. The default is *None*,
766-
in which case there is one colormap entry for each
767-
element in the list of colors. If::
755+
Parameters
756+
----------
757+
colors : list, array
758+
List of Matplotlib color specifications, or an equivalent Nx3 or Nx4
759+
floating point array (*N* rgb or rgba values).
760+
name : str, optional
761+
String to identify the colormap.
762+
N : int, optional
763+
Number of entries in the map. The default is *None*, in which case
764+
there is one colormap entry for each element in the list of colors.
765+
If::
768766
769-
N < len(colors)
767+
N < len(colors)
770768
771-
the list will be truncated at *N*. If::
769+
the list will be truncated at *N*. If::
772770
773-
N > len(colors)
771+
N > len(colors)
774772
775-
the list will be extended by repetition.
776-
"""
773+
the list will be extended by repetition.
774+
"""
775+
def __init__(self, colors, name='from_list', N=None):
777776
self.monochrome = False # True only if all colors in map are
778777
# identical; needed for contouring.
779778
if N is None:

0 commit comments

Comments
 (0)
0