plotly / plotly/plotly.R

Disappearing points

Open
#1,908 0 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

I'm using toWebGL to generate a large plotly in my R Shiny app. But when I switch tabs in the app, the points on the plot disappear.

Reproducible example below. Switch between tabs and you'll see points disappear

shinyApp(
  dashboardPage(
    dashboardHeader(title = "Example"),
    dashboardSidebar(
      sidebarMenu(
        menuItem(
          text = 'TAB1',
          tabName = 'tab_1'
        ),
        menuItem(
          text = 'TAB2',
          tabName = 'tab_2'
        )
      )
    ),
    dashboardBody(
      tabItems(
        tabItem(
          tabName = 'tab_1'
        ),
        tabItem(
          tabName = 'tab_2',
          box(
            plotlyOutput(
              "myplot"
            )
          )
        )
      )
    )
  ),
  function(input, output, session) {
    output$myplot <- renderPlotly(expr = {
      toWebGL(plot_ly(mtcars, x = ~mpg, y = ~wt))
    })
  }
)

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 R Shiny example, focusing on the toWebGL call and the plotlyOutput inside the tabItem. Reproduce the issue by switching between tabs, then trace how renderPlotly and the WebGL plot behave when the tab is hidden and shown; done means the points remain visible after tab switches.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization, frontend
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.