Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73db5b5

Browse files
committed
numpydoc style parameters and link to colors tutorial for colors.to_hex
1 parentb600026 commit73db5b5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

‎lib/matplotlib/colors.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
The module also provides functions for checking whether an object can be
3030
interpreted as a color (`is_color_like`), for converting such an object
3131
to an RGBA tuple (`to_rgba`) or to an HTML-like hex string in the
32-
"#rrggbb" format (`to_hex`), and a sequence of colors to an (n, 4)
32+
"#rrggbb" format (`
33+
`), and a sequence of colors to an (n, 4)
3334
RGBA array (`to_rgba_array`). Caching is used for efficiency.
3435
3536
Colors that Matplotlib recognizes are listed at
@@ -390,8 +391,18 @@ def to_hex(c, keep_alpha=False):
390391
"""
391392
Convert *c* to a hex color.
392393
393-
Uses the ``#rrggbb`` format if *keep_alpha* is False (the default),
394-
``#rrggbbaa`` otherwise.
394+
Parameters
395+
----------
396+
c : :doc:`color </tutorials/colors/colors>` or ``np.ma.masked``
397+
398+
keep_alpha: bool, optional
399+
Uses the ``#rrggbb`` format if *keep_alpha* is False (the default),
400+
otherwise uses ``#rrggbbaa``.
401+
402+
Returns
403+
-------
404+
str
405+
``#rrggbb`` or ``#rrggbbaa`` hex color string
395406
"""
396407
c=to_rgba(c)
397408
ifnotkeep_alpha:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp