Skip to content

Commit f2c3e62

Browse files
Clarify na_color docstring: passing any color shows non-matching elements (#600)
The previous wording "default (gets set to 'lightgray')" implied that na_color="lightgray" was a no-op, but any explicit color enables the "show non-matching elements" path. Rewrite all three render_* docstrings to make this distinction clear. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f3e13b8 commit f2c3e62

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

src/spatialdata_plot/pl/basic.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,11 @@ def render_shapes(
226226
Palette for discrete annotations. Can be a dictionary mapping category names to colors, a list of valid
227227
color names (must match the number of groups), a single named palette or matplotlib colormap name, or
228228
``None``. If element is None, broadcasting behaviour is attempted (use the same values for all elements).
229-
na_color : ColorLike | None, default "default" (gets set to "lightgray")
230-
Color to be used for NA values, if present. Can either be a named color ("red"), a hex representation
231-
("#000000ff") or a list of floats that represent RGB/RGBA values (1.0, 0.0, 0.0, 1.0). When None, the values
232-
won't be shown.
229+
na_color : ColorLike | None, optional
230+
Color for NA values and, when ``groups`` is set, for non-matching elements. When omitted, non-matching
231+
elements are hidden. Pass any explicit color (e.g. ``"lightgray"``) to show them in that color instead.
232+
Accepts a named color (``"red"``), a hex string (``"#000000ff"``), or an RGB/RGBA list
233+
(``[1.0, 0.0, 0.0, 1.0]``). Pass ``None`` to make NA values fully transparent.
233234
outline_width : float | int | tuple[float | int, float | int], optional
234235
Width of the border. If 2 values are given (tuple), 2 borders are shown with these widths (outer & inner).
235236
If `outline_color` and/or `outline_alpha` are used to indicate that one/two outlines should be drawn, the
@@ -419,10 +420,11 @@ def render_points(
419420
color names (must match the number of groups), a single named palette or matplotlib colormap name, or
420421
``None``. If `element` is `None`, broadcasting behaviour is attempted (use the same values for all
421422
elements).
422-
na_color : ColorLike | None, default "default" (gets set to "lightgray")
423-
Color to be used for NA values, if present. Can either be a named color ("red"), a hex representation
424-
("#000000ff") or a list of floats that represent RGB/RGBA values (1.0, 0.0, 0.0, 1.0). When None, the values
425-
won't be shown.
423+
na_color : ColorLike | None, optional
424+
Color for NA values and, when ``groups`` is set, for non-matching points. When omitted, non-matching
425+
points are hidden. Pass any explicit color (e.g. ``"lightgray"``) to show them in that color instead.
426+
Accepts a named color (``"red"``), a hex string (``"#000000ff"``), or an RGB/RGBA list
427+
(``[1.0, 0.0, 0.0, 1.0]``). Pass ``None`` to make NA values fully transparent.
426428
cmap : Colormap | str | None, optional
427429
Colormap for continuous annotations using 'color', see :class:`matplotlib.colors.Colormap`. If
428430
no palette is given and `color` refers to a categorical, the colors are sampled from this colormap.
@@ -765,10 +767,11 @@ def render_labels(
765767
For categorical data, use ``palette`` instead.
766768
norm : Normalize | None, optional
767769
Colormap normalization for continuous annotations, see :class:`matplotlib.colors.Normalize`.
768-
na_color : ColorLike | None, default "default" (gets set to "lightgray")
769-
Color to be used for NAs values, if present. Can either be a named color ("red"), a hex representation
770-
("#000000ff") or a list of floats that represent RGB/RGBA values (1.0, 0.0, 0.0, 1.0). When None, the values
771-
won't be shown.
770+
na_color : ColorLike | None, optional
771+
Color for NA values and, when ``groups`` is set, for non-matching labels. When omitted, non-matching
772+
labels are hidden. Pass any explicit color (e.g. ``"lightgray"``) to show them in that color instead.
773+
Accepts a named color (``"red"``), a hex string (``"#000000ff"``), or an RGB/RGBA list
774+
(``[1.0, 0.0, 0.0, 1.0]``). Pass ``None`` to make NA values fully transparent.
772775
outline_alpha : float | int, default 0.0
773776
Alpha value for the outline of the labels. Invisible by default.
774777
fill_alpha : float | int | None, optional

0 commit comments

Comments
 (0)