Additive RGB color blending for render_shapes / render_labels (and render_points)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- python
- Bereich
- data-visualization
Rechercherichtung
Beginne in pl/render.py, indem du die vorhandenen mehrkanaligen render_images-Zweige 2A/2B/2C liest, und verfolge anschließend render_shapes, render_labels und render_points. Als abgeschlossen gilt die Unterstützung von 2–3 kontinuierlichen Spalten als kanalspezifische Farben auf einer Achse mit additiver Mischung, wobei das Verhalten für die aufgeführten Palettenlängen, gemischten Typen, NaN-, Normalisierungs- und groups-Fälle definiert wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Motivation
Spun out from #321 (the thread there mixes two unrelated asks — this issue is the second one, originally raised by @brainfo).
`render_images` already supports multi-channel additive compositing: you pass several channels with per-channel colormaps and they blend into a single RGB image, mirroring napari / ImageJ / FIJI for fluorescence microscopy. The same idiom is useful for sequencing-based spatial data, where a user wants to visualize co-expression of 2–3 genes per cell/spot/region on a single axis — red for gene A, green for gene B, blue for gene C, additively blended so co-expressing cells appear yellow/cyan/white.
Today this requires manual post-processing (the user in #321 mentions doing it in Illustrator).
Proposed API
Mirror the existing `render_images` multi-channel convention by letting `color` accept a list of obs/var columns on `render_shapes`, `render_labels`, and `render_points`:
```python
sdata.pl.render_shapes(
color=["Sox2", "Pax6", "Tbr2"],
palette=["red", "green", "blue"], # one color per channel
channels_as_legend=True,
).pl.show()
sdata.pl.render_labels(
color=["Sox2", "Pax6"],
palette=["red", "green"],
).pl.show()
sdata.pl.render_points(
color=["Sox2", "Pax6"],
).pl.show()
```
Output: a single axis (no multi-panel grid). Each shape / label / point gets one composited color derived from its per-column values blended via per-channel colormaps, identical in spirit to the additive multi-channel path already in `render_images`.
Why this is feasible
- The additive-blending machinery already exists in `pl/render.py` for the multi-channel image path (see `render_images` branches 2A/2B/2C). The same per-channel cmap + sum + clip logic applies.
- Single-axis output sidesteps the hierarchy-of-axes complexity that made multi-panel `color=[...]` (the other ask from #321) undesirable.
- `channels_as_legend` already exists for `render_images`; can extend.
Scope
- In scope: 2–3-column color lists on `render_shapes`, `render_labels`, `render_points`. Per-channel `cmap` or `palette`. Additive blend on a single axis.
- Out of scope (defer or decline):
- Multi-panel grids (`sc.pl.umap`-style) — already declined in #321.
- Arbitrary blend modes beyond additive — start with the existing `render_images` semantics.
- PCA-based or learned color reductions for >3 channels.
Edge cases to design for
- Length mismatch between `color` list and `palette` list.
- Mixing categorical and continuous columns in the same `color` list (probably reject with a clear error).
- NaN handling per column (skip vs zero vs error — likely error, matching the recent `render_images` NaN rejection).
- Per-column `norm` / `vmin` / `vmax` — accept a list, parallel to the per-channel `norm` already supported on `render_images`.
- `groups` semantics when `color` is a list — likely ignored with a warning.
Relation to #321
#321 conflates two asks under "plotting multiple genes":
- Multi-panel grid for several genes — declined; possibly hosted in a future Squidpy 2.0 wrapper.
- Single-axis additive blend for co-expression visualization — this issue.
The documentation sub-tasks in #321 (`save`, `ncols` on `pl.show()`) are already resolved.
- Vorherrschende Sprache
- Python
- Sterne
- 86
- Forks
- 21
- Ø Merge
- 4 Std. 58 Min.
- Gemergte PRs (30 T.)
- 2
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus scverse/spatialdata-plot
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
scverse/spatialdata-plot#775 ·
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
scverse/spatialdata-plot#777 ·
-
`pl.show()` leading to `ValueError` due to mismatch between number of axes and number of panelsOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
scverse/spatialdata-plot#749 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
scverse/spatialdata-plot#747 ·
-
enhancement priority: medium utils :wrench:
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
scverse/spatialdata-plot#632 ·
Alle Issues in scverse/spatialdata-plot
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
raullenchai/Rapid-MLX#4042 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
LearningCircuit/local-deep-research#7067 ·
Maintainer antworten meist innerhalb von 1 Tag
-
#bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
apache/superset#44923 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
lawndoc/stack-back#123 ·