1. Overview

The purpose of this data visualisation to reveal the current covid-19 situation. The covid-19 data is selected from Tableau Coronavirus (COVID-19) Data Hub and the geographical data is from ArcGIS Hub

2. Major Challenges, Solution And Design Sketch

The covid-19 dataset is categories by province and states which resulting it not able to join with the map dataset. Therefore, some data preparation need to be done so that the covid-19 data can show on the geographical map. Data also need to re-calculated so that the visualisation can produce an accurate result. It is a challenge to generate insightful visualisation and show something more than positive cases and death cases as there are limited attributes in the covid-19 dataset. Therefore, a new column (% of death) is calculated to show the percentage of death cases from positive cases.

Here is the sketch:

3. Step-by-step Data Visualization Guide

packages = c('sf', 'tmap','tidyverse')
for (p in packages){
  if(!require(p, character.only = T)){
    install.packages(p)
  }
  library(p,character.only = T)
}


map <- st_read(dsn = "data/map", 
                layer = "map")

data <- read_csv("data/covidactivity.csv")


data <- data%>%group_by(COUNTRY_SHORT_NAME,CONTINENT_NAME) %>%
        summarise(PEOPLE_POSITIVE_CASES_COUNT = sum(PEOPLE_POSITIVE_CASES_COUNT/100),PEOPLE_DEATH_COUNT = sum(PEOPLE_DEATH_COUNT/100)) %>%
        mutate(`RATE_OF_DEATH` = (`PEOPLE_DEATH_COUNT` /`PEOPLE_POSITIVE_CASES_COUNT`)*100)


data <-  left_join(map, data, by = c("CNTRY_NAME" = "COUNTRY_SHORT_NAME"))


tmap_mode("plot")

tm_shape(data)+
  tm_fill("PEOPLE_POSITIVE_CASES_COUNT",
          n = 7,
          style = "pretty",
          palette = "Blues",
          title = "No. Of Positive Cases") +
  tm_bubbles(size ="RATE_OF_DEATH", 
             col = 'CONTINENT_NAME',
             id="CNTRY_NAME",
             breaks=c(-Inf, seq(0, 30, by=5), Inf),
             palette="-RdYlBu",
             contrast=1,
             title.size="% of Death Cases",
             title.col="Continent")+
  tm_borders(alpha = 0.5)+
  tm_layout(main.title = "Global Covid-19 Situation (Last Update: 30 Oct)",
            main.title.position = "center",
            main.title.size = 1.2,
            legend.format = list(text.separator= "-"),
            legend.outside = TRUE,
            legend.position = c("right","top"),
            frame = FALSE,
            asp=0)+
  tm_scale_bar()  +
  tm_credits("Source: Countries WGS84 from ArcGIS Hub and Covid data from Tableau", size = 0.5,position = c("left", "bottom"))

tmap_mode("view")

m<- tm_shape(data)+
  tm_fill("PEOPLE_POSITIVE_CASES_COUNT",
          n = 7,
          style = "pretty",
          palette = "Blues",
          title = "No. Of Positive Cases",
          id ="CNTRY_NAME",
          popup.vars=c("Death Cases"="PEOPLE_DEATH_COUNT","Positive Cases"="PEOPLE_POSITIVE_CASES_COUNT")) +
  tm_bubbles(size ="RATE_OF_DEATH", col = 'CONTINENT_NAME',id="CNTRY_NAME",
             popup.vars=c("% of Death Cases"="RATE_OF_DEATH"),
              breaks=c(-Inf, seq(0, 30, by=5), Inf),
              palette="-RdYlBu",
              contrast=1,
              title.size="% of Death Cases",
              title.col="Continent")+
  tm_borders(alpha = 0.5)

m + tm_view(set.zoom.limits = c(2,18))

3.1 Load packages

packages = c('sf', 'tmap','tidyverse')
for (p in packages){
  if(!require(p, character.only = T)){
    install.packages(p)
  }
  library(p,character.only = T)
}

3.2 Load data files

map <- st_read(dsn = "data/map", 
                layer = "map")

data <- read_csv("data/covidactivity.csv")

3.3 Group the data by Country Name and summarise the positive case count and death count

data <- data%>%group_by(COUNTRY_SHORT_NAME,CONTINENT_NAME) %>%
        summarise(PEOPLE_POSITIVE_CASES_COUNT = sum(PEOPLE_POSITIVE_CASES_COUNT/100),PEOPLE_DEATH_COUNT = sum(PEOPLE_DEATH_COUNT/100)) %>%
        mutate(`RATE_OF_DEATH` = (`PEOPLE_DEATH_COUNT` /`PEOPLE_POSITIVE_CASES_COUNT`)*100)

3.4 Join Data

data <-  left_join(map, data, by = c("CNTRY_NAME" = "COUNTRY_SHORT_NAME"))

3.5 Create static visualisation - filled map

tmap_mode("plot")

tm_shape(data)+
  tm_fill("PEOPLE_POSITIVE_CASES_COUNT",
          n = 7,
          style = "pretty",
          palette = "Blues",
          title = "No. Of Positive Cases")

3.6 Create static visualisation - add dot map and layer on top

+tm_bubbles(size ="RATE_OF_DEATH", 
             col = 'CONTINENT_NAME',
             id="CNTRY_NAME",
             breaks=c(-Inf, seq(0, 30, by=5), Inf),
             palette="-RdYlBu",
             contrast=1,
             title.size="% of Death Cases",
             title.col="Continent")

3.7 Create static visualisation - add customisations

+tm_borders(alpha = 0.5)+
  tm_layout(main.title = "Global Covid-19 Situation (Last Update: 30 Oct)",
            main.title.position = "center",
            main.title.size = 1.2,
            legend.format = list(text.separator= "-"),
            legend.outside = TRUE,
            legend.position = c("right","top"),
            frame = FALSE,
            asp=0)+
  tm_scale_bar()  +
  tm_credits("Source: Countries WGS84 from ArcGIS Hub and Covid data from Tableau", size = 0.5,position = c("left", "bottom"))

3.8 Create interactive visualisation - Create fillmap

tmap_mode("view") 

m<- tm_shape(data)+
  tm_fill("PEOPLE_POSITIVE_CASES_COUNT",
          n = 7,
          style = "pretty",
          palette = "Blues",
          title = "No. Of Positive Cases",
          id ="CNTRY_NAME",
          popup.vars=c("Death Cases"="PEOPLE_DEATH_COUNT","Positive Cases"="PEOPLE_POSITIVE_CASES_COUNT")) 

To customise the tooltip, popup.var is used to show the information.

3.9 Create interactive visualisation - add dot map and layer on top

  +tm_bubbles(size ="RATE_OF_DEATH", col = 'CONTINENT_NAME',id="CNTRY_NAME",
             popup.vars=c("% of Death Cases"="RATE_OF_DEATH"),
              breaks=c(-Inf, seq(0, 30, by=5), Inf),
              palette="-RdYlBu",
              contrast=1,
              title.size="% of Death Cases",
              title.col="Continent")

3.9 Create interactive visualisation - add customisations and set zoom level

  +tm_borders(alpha = 0.5)

m + tm_view(set.zoom.limits = c(2,18))

4. Final data visualization

4.1 Static Map

This visualisation is able to show the covid-19 situation globally. The filled map shows the number of positive cases and the dot map is able to show the percentage of people dead after getting covid. The colour of the dot represents different continents.

4.2 Interactive Map

In the interactive version of the map, the country name will show up when the user hovers over the countries. When the user clicks on an area of the filled map, a tooltip will show up and display information about the positive cases and the negative cases. When the user clicks on the dot, a tooltip will display the percentage of death cases.

5. Insights

  1. Insight 1: The top 3 countries are USA (about 8.4 Million), India (about 4.9 Million) and Brazil (about 4.8 Million).

  2. Insight 2: Yemen has the highest percentage of death cases out of positive cases. However, the number of positive cases is much lesser than countries such as the USA and India.

  3. Insight 3: Countries in Oceania generally have a relatively lower percentage of death cases compares to other countries in other continents