plotly / plotly/plotly.R

Empty objects in subplot

Open
#1,819 3 comments 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

An error arises when mix an empty object with ggplot-derived plotly in subplot

library(plotly); library(ggplot2)
df <- data.frame(dose=c("D0.5", "D1", "D2"), len=c(4.2, 10, 29.5))
p<-ggplot(data=df, aes(x=dose, y=len)) +geom_bar(stat="identity")
ply <- ggplotly(p)
# This gives an error.
subplot(ply, ply, ggplotly(ggplot()), nrows=1, shareX=F, shareY=F, margin=0, widths=c(0.3, 0.3, 0.3))
# This gives a warning.
subplot(ply, ply, plotly_empty(type = "scatter"), nrows=1, shareX=F, shareY=F, margin=0, widths=c(0.3, 0.3, 0.3))

What are the possible solutions? Thanks!

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 ggplotly(), subplot(), and plotly_empty() to observe the error and warning. Inspect the subplot handling for empty plot objects and define regression coverage for both cases; done means empty objects can be combined without an error or warning.

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.