8000 MNT: Issue a warning instead of logging if RGB(A) passed to scatter(..., · timhoffm/matplotlib@6d9904a · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 6d9904a

Browse files
committed
MNT: Issue a warning instead of logging if RGB(A) passed to scatter(...,
c) When to use what: - warnings.warn() in library code if the issue is avoidable and the client application should be modified to eliminate the warning - logging.warning() if there is nothing the client application can do about the situation, but the event should still be noted There are unambiguous ways for the user to specify the color (see the message). Here, the user should take action and switch from using *c* to using *color*. Thus warnings.warn() is the way to go. Closes half of matplotlib#23422.
1 parent cd185ab commit 6d9904a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4394,7 +4394,7 @@ def invalid_shape_exception(csize, xsize):
43944394
c_is_mapped = True
43954395
else: # Wrong size; it must not be intended for mapping.
43964396
if c.shape in ((3,), (4,)):
4397-
_log.warning(
4397+
_api.warn_external(
43984398
"*c* argument looks like a single numeric RGB or "
43994399
"RGBA sequence, which should be avoided as value-"
44004400
"mapping will have precedence in case its length "

0 commit comments

Comments
 (0)
0