-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Clean up BoundaryNorm docstring #8007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2b6699c
32641c7
b3b0750
da208dd
99279b4
9dd7110
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1247,25 +1247,27 @@ class BoundaryNorm(Normalize): | |
""" | ||
def __init__(self, boundaries, ncolors, clip=False): | ||
""" | ||
*boundaries* | ||
a monotonically increasing sequence | ||
*ncolors* | ||
number of colors in the colormap to be used | ||
|
||
If:: | ||
|
||
b[i] <= v < b[i+1] | ||
Parameters | ||
---------- | ||
boundaries : sequence | ||
Monotonically increasing sequence of boundaries | ||
ncolors : int | ||
Number of colors in the colormap to be used | ||
clip : bool, optional | ||
If clip is *True*, out of range values are mapped to *0* if they | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use double backquotes here and below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For clip or for True and 0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say for all (they're all "code"). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But http://matplotlib.org/devdocs/devel/documenting_mpl.html#formatting says to explicitly not do that! (at least for arguments to functions) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, that simply means I've been doing things wrong :-) |
||
are below *boundaries[0]* or mapped to *ncolors - 1* if they are | ||
above *boundaries[-1]*. | ||
|
||
If clip is *False*, out of range values are mapped to *-1* if they | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
are below *boundaries[0]* or mapped to *ncolors* if they are | ||
above *boundaries[-1]*. These are then converted to valid indices | ||
by :meth:`Colormap.__call__`. | ||
|
||
then v is mapped to color j; | ||
Notes | ||
----- | ||
If :code:`b[i] <= v < b[i+1]` then v is mapped to color j; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the two lengths don't match? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea, will try and work out and update this later today. |
||
as i varies from 0 to len(boundaries)-2, | ||
j goes from 0 to ncolors-1. | ||
|
||
Out-of-range values are mapped | ||
to -1 if low and ncolors if high; these are converted | ||
to valid indices by | ||
:meth:`Colormap.__call__` . | ||
If clip == True, out-of-range values | ||
are mapped to 0 if low and ncolors-1 if high. | ||
""" | ||
self.clip = clip | ||
self.vmin = boundaries[0] | ||
|
@@ -1304,6 +1306,13 @@ def __call__(self, value, clip=None): | |
return ret | ||
|
||
def inverse(self, value): | ||
""" | ||
Raises | ||
------ | ||
ValueError | ||
BoundaryNorm is not invertible, so calling this method will always | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
raise an error | ||
""" | ||
return ValueError("BoundaryNorm is not invertible") | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be array-like