plotly / plotly/plotly.R

Subplot fails to facet when Y-Axis contains missing values

Open
#1,460 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,

I have found that the subplot() function fails to facet when there are missing values in the Y-Axis.

For my use-case, showing breaks in a given time series is important and therefore I cannot simply remove the missing values.

Kind Regards,
Michael

library(reprex)
library(plotly)
library(dplyr)
library(tidyr)
economics %>%
  tidyr::gather(variable, value, -date) %>%
  transform(id = as.integer(factor(variable))) %>%
  mutate(value = replace(value, 1:10, NA)) %>%
  plot_ly(x = ~date, y = ~value, color = ~variable, colors = "Dark2",
          yaxis = ~paste0("y", id)) %>%
  add_lines() %>%
  subplot(nrows = 5, shareX = TRUE)

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 R reprex using plotly, dplyr, tidyr, economics, and subplot(nrows = 5, shareX = TRUE) to reproduce the missing-Y-value failure. Trace the subplot faceting path and determine how missing values affect the y-axis assignments; done means the example facets into five subplots while preserving the breaks in the time series.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.