Skip to content

plotly silently drops groups of size 1 when colouring / grouping variable is non-numeric #1876

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

Closed
cnowzohour opened this issue Nov 2, 2020 · 2 comments

Comments

@cnowzohour
Copy link

Only group "1" is shown:

plot_ly(type = "scatter", mode = "markers", x = 1:4, y = 1:4, color = c("1", "1", "1", "2"))

Making both groups have size >1 makes the bug disappear:

plot_ly(type = "scatter", mode = "markers", x = 1:4, y = 1:4, color = c("1", "1", "2", "2"))

Also grouping on a numeric variable makes the bug disappear:

plot_ly(type = "scatter", mode = "markers", x = 1:4, y = 1:4, color = c(1, 1, 1, 2))

I suspect this might be related to #1133

I am running R 3.6.3 on RHEL 7.6 with plotly 4.9.2.1

@cnowzohour cnowzohour changed the title plotly silently drops groups of size 1 when grouping variable is non-numeric plotly silently drops groups of size 1 when colouring / grouping variable is non-numeric Nov 2, 2020
@bklingen
Copy link

bklingen commented Nov 2, 2020

I couldn't replicate the error using R 4.0.2 and plotly 4.9.2.1 on Windows. Both groups do show up for me.

Only group "1" is shown:

plot_ly(type = "scatter", mode = "markers", x = 1:4, y = 1:4, color = c("1", "1", "1", "2"))

However, I get the following warnings, that I get with other plotly functions, too:

Warning messages:
1: `arrange_()` is deprecated as of dplyr 0.7.0.
Please use `arrange()` instead.
See vignette('programming') for more help
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated. 
2: In RColorBrewer::brewer.pal(N, "Set2") :
  minimal value for n is 3, returning requested palette with 3 different levels

3: In RColorBrewer::brewer.pal(N, "Set2") :
  minimal value for n is 3, returning requested palette with 3 different levels

@cnowzohour
Copy link
Author

I did some more experimenting and it seems this is only happens on my Linux machine and only in jupyter with the IRKernel. I'm closing this for now.

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

No branches or pull requests

2 participants