JohnCoene / echarts4r

🐳 ECharts 5 for R
http://echarts4r.john-coene.com/
Other
595 stars 81 forks source link

Multiple country-level map (but not at world map level) #523

Closed lgnbhl closed 1 year ago

lgnbhl commented 1 year ago

Hello, Would it be possible to create a country-level Europe map, but which doesn't render as a world map? For example creating a chloropleth map of Europe, but showing only European country shapes.

Following the reproductible example below, would it be possible to visualize only European countries? Another idea would be to zoom on Europe (but I don't know if it is possible to do this).

choropleth <- data.frame(
  countries = c(
    "France",
    "Germany",
    "Spain",
    "Italy"
  ),
  values = round(runif(4, 10, 25))
)

choropleth |>
  e_charts(countries) |>
  e_map(values, map = "world") |> # would be cool to be able to choose "europe", "asia", "africa", etc.
  e_visual_map(min = 10, max = 25) 
  # adding here another function which zoom on Europe?

Thanks a lot!

JohnCoene commented 1 year ago

Hi Felix,

You can zoom in, as is done here

Or you can find and use a custom map as demonstrated here

JohnCoene commented 1 year ago

I think this will let you download GeoJSON for Europe

lgnbhl commented 1 year ago

Thanks a lot John! I searched but was not able to find the code for zooming. It's perfect. Yes, using GeoJSON would be also a good option :). Have a nice day, Felix