Repository navigation
Commit 9995c6f
committed
refactor(render): unify color/cmap/norm pipeline — CmapParams methods + single continuous-norm (#699)
PRs 1+2 of #699, rebased onto the post-#715 (utils split) / post-#720 main.
PR3 (image-composite helper) deferred.
CmapParams gains behavior:
- fresh_norm(): a safe per-element copy (applying a Normalize autoscales vmin/vmax
in place, leaking one element's range into the next). Converts the 3 copy(norm)
sites in render.py.
- cmap_with_alpha() / colormap_with_alpha(): public-API replacement for the private
cmap._lut[:, -1] = alpha poke in the 1-channel image path; byte-identical body
colors, no shared-cmap mutation.
Single continuous-norm feeds pixels and colorbar:
- _resolve_continuous_norm(values, cmap_params) in _color.py: one resolver called by
each pixel-baking site and its matching colorbar site with the same vector, so they
cannot diverge. Folds the duplicated inline norm blocks in _color_vector_to_rgba and
_get_collection_shape (now in _geometry.py; its dead `norm` param dropped) and routes
_map_color_seg + the labels imshow + _append_outline_colorbar + the shapes set_clim
through it.
- Datashader / image / points / graph paths unchanged (already share their norm).
Behavior-preserving for normal renders; the only unified edge is an all-identical-value
outline column. Adds unit tests for the new CmapParams methods and _resolve_continuous_norm
plus a non-visual colorbar-clim integration test.1 parent bfda2ed commit 9995c6f
7 files changed
Lines changed: 223 additions & 90 deletions
File tree
- src/spatialdata_plot/pl
- tests/pl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
112 | 138 | | |
113 | 139 | | |
114 | 140 | | |
| |||
189 | 215 | | |
190 | 216 | | |
191 | 217 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 218 | + | |
201 | 219 | | |
202 | 220 | | |
203 | 221 | | |
| |||
206 | 224 | | |
207 | 225 | | |
208 | 226 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 227 | + | |
218 | 228 | | |
219 | 229 | | |
220 | 230 | | |
| |||
752 | 762 | | |
753 | 763 | | |
754 | 764 | | |
755 | | - | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
756 | 768 | | |
757 | | - | |
| 769 | + | |
| 770 | + | |
758 | 771 | | |
759 | 772 | | |
760 | 773 | | |
| |||
779 | 792 | | |
780 | 793 | | |
781 | 794 | | |
782 | | - | |
| 795 | + | |
| 796 | + | |
783 | 797 | | |
784 | 798 | | |
785 | 799 | | |
| |||
813 | 827 | | |
814 | 828 | | |
815 | 829 | | |
816 | | - | |
| 830 | + | |
817 | 831 | | |
818 | 832 | | |
819 | 833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
588 | 587 | | |
589 | 588 | | |
590 | 589 | | |
591 | | - | |
| 590 | + | |
592 | 591 | | |
593 | 592 | | |
594 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
170 | | - | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
| 218 | + | |
| 219 | + | |
232 | 220 | | |
233 | 221 | | |
234 | 222 | | |
| 223 | + | |
235 | 224 | | |
236 | 225 | | |
237 | 226 | | |
| |||
246 | 235 | | |
247 | 236 | | |
248 | 237 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 238 | + | |
257 | 239 | | |
258 | 240 | | |
259 | 241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
515 | 516 | | |
516 | 517 | | |
517 | 518 | | |
518 | | - | |
519 | | - | |
520 | | - | |
| 519 | + | |
| 520 | + | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
524 | | - | |
| 523 | + | |
525 | 524 | | |
526 | | - | |
527 | | - | |
528 | | - | |
| 525 | + | |
529 | 526 | | |
530 | 527 | | |
531 | 528 | | |
532 | | - | |
| 529 | + | |
533 | 530 | | |
534 | 531 | | |
535 | 532 | | |
| |||
747 | 744 | | |
748 | 745 | | |
749 | 746 | | |
750 | | - | |
| 747 | + | |
751 | 748 | | |
752 | 749 | | |
753 | 750 | | |
| |||
968 | 965 | | |
969 | 966 | | |
970 | 967 | | |
971 | | - | |
972 | 968 | | |
973 | 969 | | |
974 | 970 | | |
| |||
987 | 983 | | |
988 | 984 | | |
989 | 985 | | |
990 | | - | |
991 | 986 | | |
992 | 987 | | |
993 | 988 | | |
| |||
1008 | 1003 | | |
1009 | 1004 | | |
1010 | 1005 | | |
1011 | | - | |
1012 | 1006 | | |
1013 | 1007 | | |
1014 | 1008 | | |
| |||
1030 | 1024 | | |
1031 | 1025 | | |
1032 | 1026 | | |
1033 | | - | |
1034 | 1027 | | |
1035 | 1028 | | |
1036 | 1029 | | |
| |||
1043 | 1036 | | |
1044 | 1037 | | |
1045 | 1038 | | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1065 | 1044 | | |
1066 | 1045 | | |
1067 | 1046 | | |
| |||
1511 | 1490 | | |
1512 | 1491 | | |
1513 | 1492 | | |
1514 | | - | |
| 1493 | + | |
1515 | 1494 | | |
1516 | 1495 | | |
1517 | 1496 | | |
| |||
1972 | 1951 | | |
1973 | 1952 | | |
1974 | 1953 | | |
1975 | | - | |
1976 | | - | |
1977 | | - | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
1978 | 1957 | | |
1979 | 1958 | | |
1980 | 1959 | | |
| |||
2432 | 2411 | | |
2433 | 2412 | | |
2434 | 2413 | | |
2435 | | - | |
| 2414 | + | |
2436 | 2415 | | |
2437 | 2416 | | |
2438 | 2417 | | |
| |||
2465 | 2444 | | |
2466 | 2445 | | |
2467 | 2446 | | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
2468 | 2450 | | |
2469 | 2451 | | |
2470 | 2452 | | |
2471 | 2453 | | |
2472 | | - | |
| 2454 | + | |
2473 | 2455 | | |
2474 | 2456 | | |
2475 | 2457 | | |
| |||
0 commit comments