plotly / plotly/plotly.R

subplot - merging titles following ggplotly conversion

Open
#1,990 2 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

data(faithful)

p1 <- plotly::ggplotly(
  ggplot(faithful, aes(x = eruptions)) + 
    geom_histogram(bins = 20) + 
    theme_minimal()  + 
    labs(title = "A.")
)

p2 <- plotly::ggplotly(
  ggplot(faithful, aes(x = waiting)) + 
    geom_histogram(bins = 20) + 
    theme_minimal()  + 
    labs(title = "B.")
)

pl <- subplot(p1, p2, nrows = 1, titleX = TRUE)

## note  that changing to labs(tag = "A.") results in loss of the 'tag' at the ggplotly function.  

I am creating a gglot (histogram, in this case) which includes a sub-panel label. I want to then convert to a plotly figure using the plotly::ggplotly function. The label is transmitted faithfully to each of p1 and p2. However, when combining these into a subplot, the label seems to be merged . I lose the 'A.' label on the first plot p1, generally. The titleX option does not prevent this from occurring.

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 with the reproducible faithful-data example using ggplotly and subplot, then trace how subplot combines the titles from p1 and p2 when titleX is enabled. Confirm the behavior for labs(title = "A.") and labs(title = "B."); done means both labels remain visible after conversion and combination.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.