We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 224f069 commit 9b7c013Copy full SHA for 9b7c013
1 file changed
src/spatialdata_plot/pl/render.py
@@ -1341,7 +1341,11 @@ def _render_points(
1341
and isinstance(color_vector[0], str)
1342
and color_vector[0].startswith("#")
1343
):
1344
- 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
1345
+ # category), so strip alpha on the unique values and map back rather than
1346
+ # calling the per-string parser once per point.
1347
+ unique_hex, inverse = np.unique(color_vector, return_inverse=True)
1348
+ color_vector = np.asarray([_hex_no_alpha(c) for c in unique_hex])[inverse]
1349
1350
shade_how = render_params.density_how if render_params.density else "linear"
1351
# Plain density (no color column) must use the user-facing cmap as a sequential
0 commit comments