bars_data.Rd
Functional API to add and customise bars on globe.
bars_data(globe, data) bars_lat(globe, lat = "lat") bars_lon(globe, lon = "lng") bars_color(globe, color = constant("ffffaa")) bars_label(globe, label) bars_altitude(globe, altitude = 0.1) bars_radius(globe, radius = 0.25) bars_resolution(globe, resolution = 12L) bars_merge(globe, merge = TRUE) bars_transition(globe, transition = 1000L) bars_on_click(globe, func) bars_on_right_click(globe, func) bars_on_hover(globe, func)
globe | An object of class |
---|---|
data | A data.frame of points to draw. |
lat, lon | Column names or numeric value indicating coordinates. |
color | Column name or character vector indicating color of points. |
label | Column name or constant of label. |
altitude | Column name or character vector indicating altitude of points in terms of globe radius units (0 = 0 altitude (flat circle), 1 = globe radius). |
radius | Column name of radius a numeric constant for the cylinder's radius, in angular degrees. |
resolution | Numeric value defining the geometric resolution of each cylinder, expressed in how many slice segments to divide the circumference. Higher values yield smoother cylinders. |
merge | Whether to merge all the point meshes into a single ThreeJS object, for improved rendering performance. Visually both options are equivalent, setting this option only affects the internal organization of the ThreeJS objects. |
transition | Duration (ms) of the transition
to animate point changes involving geometry modifications. A value of
|
func | JavaScript function as character vector. |
# use data create_globe() %>% bars_data(quakes) %>% bars_lat("lat") %>% bars_lon("long") # use in shiny library(shiny) ui <- fluidPage( actionButton("draw", "draw points"), globeOutput("globe") ) server <- function(input, output) { output$globe <- renderGlobe({ create_globe() %>% bars_color(constant("#ffffff")) }) observeEvent(input$draw, { globeProxy("globe") %>% bars_data(quakes) %>% bars_lon("long") %>% globe_pov(-21, 179) }) }# NOT RUN { shinyApp(ui, server) # }