Add bars to a globe.

globe_bars(
  globe,
  ...,
  data = NULL,
  inherit_coords = TRUE,
  on_click = NULL,
  on_right_click = NULL,
  on_hover = NULL
)

Arguments

globe

An object of class globe as returned by create_globe, or an object of class globeProxy as returned by globeProxy.

...

Coordinates, as specified by coords.

data

A data.frame of points to draw.

inherit_coords

Whether to inherit the coordinates (coords) from create_globe. Only applies to method applied to object of class globe4r not on objects of class globeProxy.

on_click, on_right_click, on_hover

JavaScript functions as JS or TRUE to pick up the event from Shiny server side, see example.

Coordinates

Valid coordinates (depending on layer).

  • lat, lon,

  • altitude

  • radius

  • color

  • label

  • resolution

  • merge

  • transition

Examples

# basic create_globe() %>% globe_pov(-21, 179) %>% globe_bars(coords(lat, long, altitude = mag), data = quakes) # use in shiny library(shiny) ui <- fluidPage( actionButton("add", "Add points"), globeOutput("globe"), verbatimTextOutput("clicked") ) server <- function(input, output){ output$globe <- renderGlobe({ create_globe() %>% globe_img_url() }) observeEvent(input$add, { globeProxy("globe") %>% globe_bars(coords(lat, long), data = quakes, on_click = TRUE) %>% globe_pov(-21, 179) }) output$clicked <- renderPrint({ input$globe_click_bar }) }
# NOT RUN { shinyApp(ui, server) # }