Open
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
Metadata
Metadata
Assignees
Labels
No labels