plotly / plotly/plotly.R

geom_text_repel() yet to be implemented in plotly

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

I would like plotly to support ggrepel::geom_text_repel.
I prepare the following shiny that works with plotOutput but not with plotlyOutput :

library(shiny)
library(plotly)
library(ggplot2)
library(ggrepel)
library(bslib)

ui <- page_sidebar(
  title = "Hello Shiny!",
  sidebar = sidebar(
    selectizeInput(
      inputId = "Test",
      label = "Tests to show",
      choices = paste("Test",1:272),
      multiple = TRUE
    )
  ),
  plotlyOutput(outputId = "distPlot")
)

server <- function(input, output) {
  
output$distPlot <- renderPlotly({
    
  x<-faithful
  x$test<-paste("Test",1:272)
  
  ggplot(x,aes(x=eruptions,y=waiting))+
    geom_point()+
    geom_text_repel(data = x[match(input$Test,x$test),],
                    aes(label = test),
                    color="blue")
    
  })
  
}

shinyApp(ui = ui, server = server)

Marjorie Leduc
Add a comment

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 reproducing the supplied Shiny example with renderPlotly, plotlyOutput, and geom_text_repel, then compare it with the working plotOutput version. Trace how plotly handles ggplot2 layers and identify the entry point where ggrepel support is missing. Done means the example renders the repelled labels through plotlyOutput without breaking existing plotly behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
plotly, r
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.