facet_wrap causing NA values
Open
Nobody has claimed this yet.
bug
ggplotly
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
The upper tile in the following example is changed by ggplotly. I assume it is grey because it is somehow NA. Only occurs when faceting is used.
test <- structure(list(week = c(7L, 7L, 32L), day = structure(c(5L, 6L,
1L), .Label = c("Mon", "Tues", "Wed", "Thurs", "Fri", "Sat",
"Sun"), class = c("ordered", "factor")), year = c(2017, 2017,
2015), `Samples #` = c(31L, 49L, 20L)), class = c("tbl_df", "tbl",
"data.frame"), row.names = c(NA, -3L), .Names = c("week", "day",
"year", "Samples #"))
p <- ggplot(data = test, aes(x = day, y = week, fill = `Samples #`, height = 1)) +
geom_tile() +
facet_wrap(~year, ncol = 1)
p

ggplotly(p)

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 provided R reproduction with ggplot, geom_tile, facet_wrap, and ggplotly(p), then compare the faceted output with the original plot. Done means the upper tile retains the correct value and appearance instead of becoming grey or NA when faceting is used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100