Description Usage Arguments Examples
Dynamically add bubble using Shiny.
| 1 | update_bubbles(proxy, lon, lat, radius, color, name, ...)
 | 
| proxy | a proxy as returned by  | 
| lon, lat | coordinates of bubbles. | 
| radius | radius of bubbles. | 
| color | color of bubbles. | 
| name | name of bubbles. | 
| ... | any other variable to use in tooltip. | 
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | ## Not run: 
library(shiny)
ui <- fluidPage(
 numericInput(
   "lon",
   "Longitude",
   value = 50
 ),
 numericInput(
   "lat",
   "Latitude",
   value = 50
 ),
 textInput(
   "city",
   "City",
   value = "City"
 ),
 sliderInput(
   "value",
   "Value",
   min = 1,
   max = 4,
   step = 1,
   value = 3
 ),
 actionButton(
   "sub",
   "Submit"
 ),
 datamapsOutput("map")
)
server <- function(input, output){
  coords <- data.frame(city = c("London", "New York", "Beijing", "Sydney"),
                       lon = c(-0.1167218, -73.98002, 116.3883, 151.18518),
                       lat = c(51.49999, 40.74998, 39.92889, -33.92001),
                       values = 1:4)
  update <- reactive({
    df <- data.frame(city = input$city, lon = input$lon, lat = input$lat, values = input$value)
    rbind.data.frame(coords, df)
  })
  output$map <- renderDatamaps({
    coords %>%
      datamaps() %>%
      add_bubbles(lon, lat, values * 2, values, city)
  })
  observeEvent(input$sub, {
    datamapsProxy("map") %>%
      add_data(update()) %>% # pass updated data
      update_bubbles(lon, lat, values * 2, values, city) # update
  })
}
shinyApp(ui, server)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.