plotly / plotly/plotly.R

Empty facets when using subplot on multiple facet plots with shareX = TRUE

Open
#1,962 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

When running the code below, the first subplot produces 4 empty facets in the two plotlys while the latter produces no empty facets (expected). I notice that the third and fourth xaxis x3 and x4 do not exist in the plotly object xaxis property in $x$data. It seems to be hard capped at two such that the traces intended for the >2 facets are accumulated into the second facet (x2)

library(tidyverse)
library(plotly)
facet_plot <- ggplotly(
  tibble(x = rnorm(75), y = rnorm(75), type = rep(LETTERS[1:3], 25)) %>%
    ggplot(aes(x, y)) + geom_point() + facet_wrap(~ type))
subplot(facet_plot, facet_plot, nrows = 2, shareX = TRUE)
subplot(facet_plot, facet_plot, nrows = 2)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reproducible R example with two facet plots and compare the shared-X and unshared-X subplot results. Inspect the plotly object's x$data xaxis entries, especially x3 and x4; done means shared subplots retain all facet axes and no empty facets appear.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.