Functional API to add and customise hex on globe.

hex_data(globe, data)

hex_lat(globe, lat = "lat")

hex_lon(globe, lon = "lng")

hex_weight(globe, weight = 1L)

hex_label(globe, label)

hex_resolution(globe, resolution = 4L)

hex_margin(globe, margin = 0.2)

hex_cap_color(globe, color = constant("#ffffaa"))

hex_side_color(globe, color = constant("#ffffaa"))

hex_merge(globe, merge = TRUE)

hex_transition(globe, transition = 1000L)

hex_on_click(globe, func)

hex_on_right_click(globe, func)

hex_on_hover(globe, func)



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


A data.frame of points to draw.

lat, lon

Column names or numeric value indicating coordinates.


Column name or JavaScript function defining height of hex.


Column name or constant of label.


Numeric value defining the geometric resolution of each cylinder, expressed in how many slice segments to divide the circumference. Higher values yield smoother cylinders.


The radial margin of each hexagon. Margins above 0 will create gaps between adjacent hexagons and serve only a visual purpose, as the data points within the margin still contribute to the hexagon's data. The margin is specified in terms of fraction of the hexagon's surface diameter. Values below 0 or above 1 are disadvised. This property also supports using an accessor method based on the hexagon's aggregated data, following the syntax: htmlwidgets::JS('hexMargin(({ points, sumWeight, center: { lat, lng }}) => ...)'). This method should return a numeric constant.


Column name or character vector indicating color of points.


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.


Duration (ms) of the transition to animate point changes involving geometry modifications. A value of 0 will move the objects immediately to their final position. New objects are animated by scaling them from the ground up. Only works if merge is disabled.


JavaScript function as character vector.


# use data create_globe() %>% hex_data(quakes) %>% hex_lat("lat") %>% hex_lon("long") %>% hex_weight(1L)