plot_ly boxplot showing wrong x-axis
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
Suppose I have a list with three slots, but data for slots 2 and 3 are not yet available. When plotting a boxplot with just the first two slots, everything works as expected:
library(plotly)
y <- list("Group 1" = c(105,74,20),
"Group 2" = NA_real_,
"Group 3" = NA_real_)
boxplot <- plot_ly(type="box")
boxplot %>%
add_boxplot(x=y[[1]]) %>%
add_boxplot(x=y[[2]])

But when trying to plot data for all three slots (where slots 2 and 3 don't have data), then the x-axis label is messed up and the data seems to be messed up as well. (I expected the boxplot to look exactly the same as the one above.)
boxplot %>%
add_boxplot(x=y[[1]]) %>%
add_boxplot(x=y[[2]]) %>%
add_boxplot(x=y[[3]])

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.
Research direction
Start by running the issue's R reproduction with plot_ly(type="box") and successive add_boxplot(x=y[[...]] ) calls, comparing two traces with three. Trace how add_boxplot handles NA_real_ inputs and x-axis category assignment. Done means adding empty slots does not change the displayed data or x-axis label compared with the two-slot example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100