Skip to contents

e_globe family is similar to e_geo_3d e_map, or e_map_3d.

Note: As the package became too large (borderline for CRAN), assets have been moved to another package: echarts4r.assets. This also allows the introduction of more assets.

Deprecated:

  • e_stars_texture
  • e_globe_texture
  • e_map_texture

Visit the website for more examples.

#install.packages("remotes")
remotes::install_github("JohnCoene/echarts4r.assets")

Scatter 3D

library(echarts4r.assets)

airports <- read.csv(
  paste0("https://raw.githubusercontent.com/plotly/datasets/",
         "master/2011_february_us_airport_traffic.csv")
)

airports |> 
  e_charts(long) |> 
  e_globe(
    environment = ea_asset("starfield"),
    base_texture = ea_asset("world"), 
    globeOuterRadius = 100
  ) |> 
  e_scatter_3d(lat, cnt, coord_system = "globe", blendMode = 'lighter') |> 
  e_visual_map(inRange = list(symbolSize = c(1, 10)))

Bar

url <- "https://echarts.apache.org/examples/data-gl/asset/data/population.json"
data <- jsonlite::fromJSON(url)
data <- as.data.frame(data)
names(data) <- c("lon", "lat", "value")

data |> 
  e_charts(lon) |> 
  e_globe(
    environment = ea_asset("starfield"),
    base_texture = ea_asset("world topo"), 
    height_texture = ea_asset("world topo"),
    displacementScale = 0.04
  ) |> 
  e_bar_3d(lat, value, coord_system = "globe") |> 
  e_visual_map(show = FALSE)

Lines

flights <- read.csv(
  paste0("https://raw.githubusercontent.com/plotly/datasets/",
         "master/2011_february_aa_flight_paths.csv")
)

flights |> 
  e_charts() |> 
  e_globe(
    environment = ea_asset("starfield"),
    base_texture = ea_asset("world topo"), 
    height_texture = ea_asset("world topo"),
    displacementScale = 0.05
  ) |> 
  e_lines_3d(
    start_lon, 
    start_lat, 
    end_lon, 
    end_lat,
    name = "flights",
    effect = list(show = TRUE)
  ) |> 
  e_legend(FALSE)