-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add continuous color scale to strip, box, and violin plots #1938
Comments
Hi Joel! What you're trying to do makes sense in principle, although unfortunately the changes required to implement it all sit at the Javascript level, in plotly.js. Another approach would be to add |
PS: your workaround is pretty good actually! If you bin the continuous variable in Python and then color by that you can get pretty close! |
Thanks for the reply @nicolaskruchten ! I suspected that this would have to be added in the js layer, but I wasn't sure how to provide example code in js so I decided to open an issue here to start. I think this would be great functionality to add to plotly, should I open a separate issue in plotly.js and reference this one? To me, the first solution you suggested above would be preferable since it is then possible to also color the points when used together with violin or box. |
Any follow-ups about this issue? It seems like this continuous color scale issue for box plot is not resolved. |
Correct, we have not implemented this feature and no one is working on it at the moment. |
+1 on adding this functionality. Curious if anyone has new/different work around to accomplish dots with a continuous color scale. |
+1 |
Yep this would be extremely useful! |
|
This feature would be helpful; I'm trying to replicate a summary plot for SHAP values, and I have not been able to do it. |
Same! It's a shame. |
Hello! The same is for me. I'm trying to create a new feature importance visualization and I will need this. Hoper there will be a fix soon. |
+1 |
What I did was generate an Explanation object and then use the shap library's plots functionalities. Hope this helps! |
Has another workaround been found? I need the points to be colored differently than the violin part. Is there any way to iterate through fig.data to modify values one by one? Either with the marker size or the marker color? |
Check out this post to complement this workaround. |
+1 |
+1 |
1 similar comment
+1 |
Currently, strip/box/violin plots only work with categorical/discrete colormaps. This is sufficient for the violins and boxes but for the points that can be included in all three plots, it would be useful to color by a continuous feature and to add a colorbar to the plot. I looked around a bit and it seems like the go.Box constructor needs to have the coloraxis attrbute added to it (and I suspect something would need to be added to avoid coloring the boxes/violins in the same colors as the points, since they are colored the same for categorical variables).
The example below illustrates the issue by trying to color by the sepal_width variable:
The resulting plot is not meaningful since it colors a continuous variable with a discrete colormap.
So far, I have not found a prettier workaround that this (which is imperfect since it uses the legend instead of a colorbar):
The text was updated successfully, but these errors were encountered: