Skip to contents

e_geo family is similar to e_geo_3d e_map, e_map_3d or e_globe.

Points

quakes |> 
  e_charts(long) |> 
  e_geo(
    roam = TRUE,
    boundingCoords = list(
      c(185, - 10),
      c(165, -40)
    )
  ) |> 
  e_scatter(
    lat, mag, 
    coord_system = "geo"
  ) |> 
  e_visual_map(mag, scale = e_scale)

Lines

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

flights |> 
  e_charts() |> 
  e_geo() |> 
  e_lines(
    start_lon, 
    start_lat, 
    end_lon, 
    end_lat,
    name = "flights",
    lineStyle = list(normal = list(curveness = 0.3))
   )

Heatmap

quakes |>
  e_charts(long) |> 
  e_geo(
    boundingCoords = list(
      c(190, -10),
      c(180, -40)
   )
  ) |> 
  e_heatmap(
    lat, 
    mag, 
    coord_system = "geo", 
    blurSize = 5, 
    pointSize = 3
  ) |> 
  e_visual_map(mag)

GeoJSON

The companion package echarts4r.maps comes with 215 maps.

You can install the package with:

install.packages("remotes")
remotes::install_github('JohnCoene/echarts4r.maps')

View the full list of maps with echarts4r.maps::em_bank().

library(echarts4r.maps)

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

flights |> 
  e_charts() |> 
  em_map("USA") |>
  e_geo("USA") |> 
  e_lines(
    start_lon, 
    start_lat, 
    end_lon, 
    end_lat,
    name = "flights",
    lineStyle = list(normal = list(curveness = 0.3))
   )

You can also use your own geoJSON with e_map_register.