Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geom_text_repel() yet to be implemented in plotly #2422

Open
MarjorieLeduc opened this issue Feb 6, 2025 · 1 comment
Open

geom_text_repel() yet to be implemented in plotly #2422

MarjorieLeduc opened this issue Feb 6, 2025 · 1 comment

Comments

@MarjorieLeduc
Copy link

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

@romanzenka
Copy link

Duplicate of #2408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants