8000 Clean up BoundaryNorm docstring by dstansby · Pull Request #8007 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 6 commits into from
Mar 5, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
BoundaryNorm docstring clarification
  • Loading branch information
dstansby committed Feb 3, 2017
commit b3b07509455fadd3c95acbe3e623aaaa5508e16b
16 changes: 9 additions & 7 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,17 +1246,17 @@ class BoundaryNorm(Normalize):
between integer and floating point.
"""
def __init__(self, boundaries, ncolors, clip=False):
r"""
"""
Parameters
----------
boundaries : sequence
Copy link
Member

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

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
are below *boundaries[0]* or mapped to *ncolors - 1* if they are
above *boundaries[-1]*.
If *clip* is ``True``, out of range values are mapped to 0 if they
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove the *? They make docstrings hard to read in the terminal

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

False and boundaries[0] to be consistent with the previous paragrpha

are below *boundaries[0]* or mapped to *ncolors* if they are
Expand All @@ -1265,9 +1265,11 @@ def __init__(self, boundaries, ncolors, clip=False):

Notes
-----
If :code:`b[i] <= v < b[i+1]` then v is mapped to
floor( :math:`\frac{n_{colors}- 1}{n_{bins} - 1} * i`), where nbins is
is ``len(boundaries) - 2``.
*boundaries* defines the edges of bins, and data falling within a bin
is mapped to the color with the same index.

If the number of bins doesn't equal *ncolors*, the color is chosen
by linear inpolation of the bin number onto color numbers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"interpolation"

"""
self.clip = clip
self.vmin = boundaries[0]
Expand Down
0