Skip to content

Feature request: Coordinates of mouse clicks when used with Shiny #1194

Open
@KasperSkytte

Description

@KasperSkytte

When using plotly with Shiny, would it be possible to implement a feature in plotly::plotlyOutput() similar to plotOutput("plot", click = "plot_click") to capture the exact coordinates of a mouse click like in the example below?

library(shiny)

ui <- basicPage(
  plotOutput("plot1", click = "plot_click"),
  verbatimTextOutput("info")
)

server <- function(input, output) {
  output$plot1 <- renderPlot({
    plot(mtcars$wt, mtcars$mpg)
  })

  output$info <- renderText({
    paste0("x=", input$plot_click$x, "\ny=", input$plot_click$y)
  })
}

shinyApp(ui, server)

I am hoping to be able to reproduce the exact mouse click positions during a data analysis and reuse them in a different analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions