Commit 3ff8455
authored
Honor cmap for numeric scatter colors (#616)
* Honor cmap for numeric scatter colors
Treat 1D numeric scatter c arrays matching the point count as scalar data for colormapping instead of literal RGBA colors. This preserves Nx3/Nx4 explicit color support, keeps the Matplotlib-compatible cmap behavior for numeric values, and adds a regression test for issue #615.
* Add type hints to scatter color parsing
Annotate the scatter-specific color parsing helpers touched by the cmap compatibility fix so the intent of the new parameters and return values is explicit without broadening the typing changes beyond the affected code path.
* Clarify scatter color semantics in docs
Document the scatter color ambiguity resolved by the PR: one-dimensional numeric arrays matching the point count are treated as scalar colormap data, while explicit RGB(A) colors should be passed as N x 3 / N x 4 arrays or via color=.
* Add return
* Tighten scatter helper input types
Replace the loose Any annotations on the scatter color parsing helpers with explicit data and color input aliases based on ArrayLike and color tuples. This keeps the typing aligned with the actual ambiguity being resolved by the cmap fix while staying practical for plotting inputs.1 parent 69e0001 commit 3ff8455
2 files changed
Lines changed: 74 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
67 | 74 | | |
68 | 75 | | |
69 | 76 | | |
| |||
993 | 1000 | | |
994 | 1001 | | |
995 | 1002 | | |
996 | | - | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
997 | 1007 | | |
998 | 1008 | | |
999 | 1009 | | |
| |||
3963 | 3973 | | |
3964 | 3974 | | |
3965 | 3975 | | |
3966 | | - | |
| 3976 | + | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
| 3984 | + | |
| 3985 | + | |
| 3986 | + | |
3967 | 3987 | | |
3968 | 3988 | | |
3969 | 3989 | | |
| |||
3972 | 3992 | | |
3973 | 3993 | | |
3974 | 3994 | | |
3975 | | - | |
| 3995 | + | |
3976 | 3996 | | |
3977 | 3997 | | |
3978 | 3998 | | |
| |||
4000 | 4020 | | |
4001 | 4021 | | |
4002 | 4022 | | |
| 4023 | + | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
4003 | 4049 | | |
4004 | 4050 | | |
4005 | 4051 | | |
| |||
5527 | 5573 | | |
5528 | 5574 | | |
5529 | 5575 | | |
| 5576 | + | |
5530 | 5577 | | |
5531 | 5578 | | |
5532 | 5579 | | |
| |||
5542 | 5589 | | |
5543 | 5590 | | |
5544 | 5591 | | |
| 5592 | + | |
5545 | 5593 | | |
5546 | 5594 | | |
5547 | 5595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
378 | 380 | | |
379 | 381 | | |
380 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
381 | 403 | | |
382 | 404 | | |
383 | 405 | | |
| |||
0 commit comments