Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coloring by boolean column type does not work #2121

Closed
WillKoehrsen opened this issue Jun 17, 2019 · 1 comment · Fixed by #2127
Closed

Coloring by boolean column type does not work #2121

WillKoehrsen opened this issue Jun 17, 2019 · 1 comment · Fixed by #2127

Comments

@WillKoehrsen
Copy link

When trying to color a scatter plot by a bool column datatype, the colors do not show:

(see attached file for data)

grouped.dtypes

mean_ape            float64
measurement_type     object
note                 object
parameters           object
n_estimators          int64
max_depth             int64
bootstrap              bool
max_features        float64

fig = px.scatter(
    grouped,
    x="n_estimators",
    y="mean_ape",
    facet_row="measurement_type",
    color="bootstrap",
    title="Error vs Number of Estimators Colored by Bootstrap",
    height=1000, width=1600
)

Screen Shot 2019-06-17 at 08 52 13 EDT

However, if I convert the bool column to a str, then the colors correctly appear:

new_grouped = grouped.copy()
new_grouped['bootstrap'] = new_grouped['bootstrap'].astype(str)

fig = px.scatter(
    new_grouped,
    x="n_estimators",
    y="mean_ape",
    facet_row="measurement_type",
    color="bootstrap",
    title="Error vs Number of Estimators Colored by Bootstrap",
    height=1000, width=1600
)

Screen Shot 2019-06-17 at 08 53 13 EDT

grouped.csv.zip

@nicolaskruchten
Copy link
Contributor

Definitely a bug, we'll fix it! thanks for the detailed report :)

@nicolaskruchten nicolaskruchten transferred this issue from plotly/plotly_express Jan 24, 2020
@nicolaskruchten nicolaskruchten added this to the v4.6.0 milestone Jan 24, 2020
@emmanuelle emmanuelle mentioned this issue Jan 24, 2020
@nicolaskruchten nicolaskruchten removed this from the v4.6.0 milestone Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants