examples.Rmd
You see the maps available by running the following:
Otherwise, the full list of maps is vailable here.
There are 215 maps, here are two.
library(echarts4r)
#> Welcome to echarts4r
#>
#> Docs: echarts4r.john-coene.com
library(echarts4r.maps)
jp <- e_charts() %>%
em_map("Japan") %>%
e_map(map = "Japan")
ca <- e_charts() %>%
em_map("Canada") %>%
e_map(map = "Canada")
e_arrange(jp, ca, cols = 2, rows = 1)
Use em_map
to add the map, simply pass the name of the country, a valid name as returned by em_bank
, then reference that name in e_map
.
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))
)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
data("cities")
cities %>%
filter(country == "IN") %>%
mutate(val = runif(n(), 1, 3)) %>%
e_charts(lon) %>%
em_map("India") %>%
e_geo(map = "India") %>%
e_scatter(lat, val, coord_system = "geo", scale = NULL) %>%
e_visual_map(min = 1, max = 3)