Tamara Koliada
Tamara Koliada

Reputation: 1194

How to create infographics map with gradient scale to show spread of coronovirus by regions/countries?

I know only one way which can create a map like this - using tableau.

But in Tableau you can map specific countries - not possible to map additionally regions with gradient scale . Need to customize background map and map style - add additional map layers and data layers.

enter image description here

In Tableau possible to get Data Set with Latitudes and Longitudes of interesting regions, but since scale in regions are different - one city can have one confirmed case - another city can have 1000 - I wanna use gradient scale.

enter image description here

My ideal map is a combination of these two examples.

Is there is any other software/frameworks which allow creating world map with a gradient scale of data inside the country?

and have direct access to regions inside the country as well? Coz I want to connect it to software which parses news feed relates to a number of new cases in some city/district/country.

Instead of circles, I wanna show gradient scale of number of cases.

enter image description here

Upvotes: 0

Views: 521

Answers (1)

Mr.Rlover
Mr.Rlover

Reputation: 2623

Here's a good place to start, using the sf, rnaturalearth packages.

install.packages(c("cowplot", "googleway", "ggplot2", "ggrepel", 
                   "ggspatial", "libwgeom", "sf", "rnaturalearth", "rnaturalearthdata"))

library("ggplot2")
theme_set(theme_bw())
library("sf")

library("rnaturalearth")
library("rnaturalearthdata")
library("tidyverse")

world <- ne_countries(scale = "medium", returnclass = "sf")
class(world)

corona <- readxl::read_excel('corona cases.xlsx', sheet = "Sheet1")

world$corona <- NA

for (i in 1:nrow(corona)){
  for (j in 1:nrow(world)){

    country <- as.character(corona[i, 1])

    sov_rows <- which(world$sovereignt %in% country)

    world[sov_rows,"corona"] <- corona[i, 2]

  }

}

sov_rows <- which(world$sovereignt %in% "China")

world[sov_rows,"corona"] <- NA

ggplot(data = world) +
  geom_sf(aes(fill = corona)) +
  scale_fill_viridis_c(option = "plasma", trans = "sqrt")

enter image description here

Upvotes: 1

Related Questions