pie chart color mapping doesn't work properly when aggregating data
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- r
- Domain
- data-visualization
Research direction
Start by running the two provided plot_ly examples with mtcars and compare the pie slice colors for aggregated and unaggregated data. Review issue #1375 and trace the color handling for pie charts; done when the supplied colors consistently map to the correct groups without requiring extra color entries.
Written by the indexing model from the issue text.
Description
This seems to be maybe a partial regression related to #1375. Using similar code to that issue:
library(plotly)
plot_ly(mtcars[c(1,3,5), c("cyl", "drat")], labels = ~cyl, values = ~drat, type = 'pie',
marker = list(colors = c("cyan", "magenta", "black"))) %>%
layout(xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
plot_ly(mtcars[, c("cyl", "drat")], labels = ~cyl, values = ~drat, type = 'pie',
marker = list(colors = c("cyan", "magenta", "black"))) %>%
layout(xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
It seems to apply the default palette color to the first group.
Interestingly, if you bang it in there a few more times it shows (though with different order).
plot_ly(mtcars[, c("cyl", "drat")], labels = ~cyl, values = ~drat, type = 'pie',
marker = list(colors = c("cyan", "magenta", "black", "magenta", "magenta"))) %>%
layout(xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from plotly/plotly.R
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
save_image Error Open
Difficulty 3/5 1-2 days Newbie friendliness 52/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
easystats/performance#950 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
briandconnelly/airnow#9 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OHDSI/CohortConstructor#774 ·