-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When switching the color_by
value dynamically, it seems like the coloring logic is kept to the original column and does not consider the new data type.
Consider the code below:
import pandas as pd
import jscatter
import numpy as np
n = 50
categories = [f"cat_{i}" for i in range(3)]
df = pd.DataFrame({
"x": np.random.rand(n),
"y": np.random.rand(n),
"length": np.random.rand(n),
"cat": np.random.choice(categories, size=n),
})
df["cat"] = df["cat"].astype("category")
scatter = jscatter.Scatter(
data=df,
x="x",
y="y",
color_by="cat",
size=10,
legend=True,
tooltip=True,
tooltip_properties=["cat"],
tooltip_size="large",
height=200,
width=500,
legend_size="large",
)
scatter.show()

Now switch the color_by
value:
scatter.color(by="length")
And the colors are now wrong:

While it should be:

Note that the other way around (from continuous to category) fail as well.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working