Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/spatialdata_plot/pl/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,11 @@ def _render_points(
and isinstance(color_vector[0], str)
and color_vector[0].startswith("#")
):
color_vector = np.asarray([_hex_no_alpha(c) for c in color_vector])
# color_vector usually holds only a few distinct hex strings (one per
# category), so strip alpha on the unique values and map back rather than
# calling the per-string parser once per point.
unique_hex, inverse = np.unique(color_vector, return_inverse=True)
color_vector = np.asarray([_hex_no_alpha(c) for c in unique_hex])[inverse]

shade_how = render_params.density_how if render_params.density else "linear"
# Plain density (no color column) must use the user-facing cmap as a sequential
Expand Down
Loading