Skip to content

Instantly share code, notes, and snippets.

@corynissen
Created July 14, 2014 14:57
Show Gist options
  • Save corynissen/17fbd9c3c2932b100349 to your computer and use it in GitHub Desktop.
Save corynissen/17fbd9c3c2932b100349 to your computer and use it in GitHub Desktop.
ggmap click locator
library(shiny)
library(ggmap)
shinyServer(function(input, output) {
output$chicagoPlot <- renderPlot({
p <- qmap("chicago IL")
print(p)
})
output$clicks <- renderText({
x <- input$click$x
y <- input$click$y
paste0("X location is: ", x, " Y location is: ", y)
})
})
library(shiny)
shinyUI(basicPage(
titlePanel("Chicago"),
br(),
plotOutput("chicagoPlot", width = 800, height=442, clickId="click"),
br(),
textOutput("clicks")
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment