Skip to content

Commit

Permalink
If a Series with row index is passed as labels and values it can mess…
Browse files Browse the repository at this point in the history
… things up -- just cast to array
  • Loading branch information
lmcinnes authored Nov 14, 2023
1 parent 933182e commit 14f92ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions umap/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ def interactive(
data = pd.DataFrame(_get_embedding(umap_object), columns=("x", "y"))

if labels is not None:
data["label"] = labels
data["label"] = np.asarray(labels)

if color_key is None:
unique_labels = np.unique(labels)
Expand All @@ -1423,7 +1423,7 @@ def interactive(
colors = "color"

elif values is not None:
data["value"] = values
data["value"] = np.asarray(values)
palette = _to_hex(plt.get_cmap(cmap)(np.linspace(0, 1, 256)))
colors = btr.linear_cmap(
"value", palette, low=np.min(values), high=np.max(values)
Expand Down

0 comments on commit 14f92ca

Please sign in to comment.