Skip to content

geom_text_repel() yet to be implemented in plotly #2422

Open
@MarjorieLeduc

Description

@MarjorieLeduc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions