Better support for trellis displays
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
There are a few different ways to do a trellis display currently, but these are all a bit esoteric
one_plot <- function(d) {
plot_ly(d, x = ~wt, y = ~mpg)
}
mtcars %>%
group_by(vs) %>%
do(plot = one_plot(.)) %>%
subplot(nrows = NROW(.))
plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~factor(vs), yaxis = ~paste0("y", vs + 1)) %>%
subplot(nrows = 2)
plot_ly(mtcars, x = ~wt, y = ~mpg, split = ~factor(vs), yaxis = ~paste0("y", vs + 1)) %>%
subplot(nrows = 2)
#726 implements a trellis argument, which essentially maps that variable to sensible trace anchors, then uses subplot()'s machinery to populate axis objects. The problem is, we have guarantee a subplot is returned if we want a sensible result for:
plot_ly(mtcars, x = ~wt, y = ~mpg, trellis = ~vs)
Thus, we lose the ability to specify the number of rows in that subplot
It'd be better to have trellis() function:
trellis <- function(p, formula, ...) {
# do some stuff here
subplot(p, ...)
}
Ideally, the trellising would work a lot like ggplot2 facets (trellising variables should not appear in legends, and appear as annotations instead). This is what we do in ggplotly() via clever use of showlegend and legendgroup.
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
Review the trellis argument proposed in #726 and the existing subplot() machinery first. A completed solution should provide a trellis() function that preserves control over subplot rows and supports ggplot2-like behavior, including keeping trellising variables out of legends and showing them as annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100