Skip to content

Commit 2b6699c

Browse files
committed
Clean up BoundaryNorm docstring
1 parent f858cc5 commit 2b6699c

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

lib/matplotlib/colors.py

+25-16
Original file line numberDiff line numberDiff line change
@@ -1247,25 +1247,27 @@ class BoundaryNorm(Normalize):
12471247
"""
12481248
def __init__(self, boundaries, ncolors, clip=False):
12491249
"""
1250-
*boundaries*
1251-
a monotonically increasing sequence
1252-
*ncolors*
1253-
number of colors in the colormap to be used
1254-
1255-
If::
1256-
1257-
b[i] <= v < b[i+1]
1250+
Parameters
1251+
----------
1252+
boundaries : sequence
1253+
Monotonically increasing sequence of boundaries
1254+
ncolors : int
1255+
Number of colors in the colormap to be used
1256+
clip : bool, optional
1257+
If clip is *True*, out of range values are mapped to *0* if they
1258+
are below *boundaries[0]* or mapped to *ncolors - 1* if they are
1259+
above *boundaries[-1]*.
1260+
1261+
If clip is *False*, out of range values are mapped to *-1* if they
1262+
are below *boundaries[0]* or mapped to *ncolors* if they are
1263+
above *boundaries[-1]*. These are then converted to valid indices
1264+
by :meth:`Colormap.__call__`.
12581265
1259-
then v is mapped to color j;
1266+
Notes
1267+
-----
1268+
If :code:`b[i] <= v < b[i+1]` then v is mapped to color j;
12601269
as i varies from 0 to len(boundaries)-2,
12611270
j goes from 0 to ncolors-1.
1262-
1263-
Out-of-range values are mapped
1264-
to -1 if low and ncolors if high; these are converted
1265-
to valid indices by
1266-
:meth:`Colormap.__call__` .
1267-
If clip == True, out-of-range values
1268-
are mapped to 0 if low and ncolors-1 if high.
12691271
"""
12701272
self.clip = clip
12711273
self.vmin = boundaries[0]
@@ -1304,6 +1306,13 @@ def __call__(self, value, clip=None):
13041306
return ret
13051307

13061308
def inverse(self, value):
1309+
"""
1310+
Raises
1311+
------
1312+
ValueError
1313+
BoundaryNorm is not invertible, so calling this method will always
1314+
raise an error
1315+
"""
13071316
return ValueError("BoundaryNorm is not invertible")
13081317

13091318

0 commit comments

Comments
 (0)