Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.

Original


Source: WHO/UNICEF Joint Monitoring Programme for Water Supply, Sanitation and Hygiene (JMP).


Objective

The objective here is to analyse the existing visualization on Population having access to safe drinking water around the world. It’s estimated that only 71% of the world population has access to safe drinking water. This means 29% of the world does not have access.

The visualisation chosen had the following three main issues:

  • The colour scale used here to plot the percentages of population getting the safe water to drink is not readable.
  • The second one is people might select wrong countries because of their smaller greographic area and one cannot remember all the country locations to click on the particular country to find the respective values.
  • Here there is no data for most of the countries. Plotting a map is almost not useful. Among the plotted countries, the population percentage < 70 is bit hard to find because most of the countries with <70 % has the smaller geographic value.

Reference

Code

The following code was used to fix the issues identified in the original.

library(readr)
proportion_using_safely_managed_drinking_water <- read_csv("C:/Users/admin/Downloads/proportion-using-safely-managed-drinking-water.csv")

# Libraries
library(ggplot2)
library(scales)
library(dplyr)
library(tidyverse)
library(hrbrthemes)
library(kableExtra)


data_2015 <- proportion_using_safely_managed_drinking_water %>% filter(Year == 2015)

  
b = colnames(data_2015)
names(data_2015)[names(data_2015) == "Drinking water - Proportion of population using improved water supplies - Safely managed - National - Percent (%)"] <- "Value"
data_2015 <- data_2015 %>% filter(Value < 70)
map <- data_2015 %>%
  filter(!is.na(Value)) %>%
  arrange(Value) %>%
  tail(25) %>%
  mutate(Entity=factor(Entity, Entity)) %>%
  ggplot( aes(x=Entity, y=Value) ) +
  geom_bar(stat="identity",fill="#009E73") +
  theme_ipsum() +
  theme(
    panel.grid.minor.y = element_blank(),
    panel.grid.major.y = element_blank(),
    legend.position="none"
  ) +
  xlab("Countries") +
  ylab("Percentage") + 
  coord_flip()

Data Reference

Reconstruction

The countries with smaller percentage of accessing safe drinking water is plotted here. This will eradicate the problem of selecting the country on the map. One can easily depicts the percentage of access to drinking water by country name juzt by looking at the below plot.