Energy Access Globally Overtime
Over the past two decades, there has been a remarkable surge in
global access to electricity. South Asia, which was ranked second lowest
in terms of electricity access in 2000, has made significant
improvements, nearly doubling its access rate to reach an impressive
98.77% by 2021. This progress underscores the region’s commitment to
bridging the gap in energy accessibility. However, despite these
advancements, Sub-Saharan Africa continues with only 50.57% of its
population having access to electricity according to the most recent
data available. This figure reflects the stark reality of energy poverty
in Sub-Saharan Africa, making it one of the most underdeveloped regions
globally in terms of energy access. Efforts to address this issue are
crucial for the region’s socio-economic development and the improvement
of the quality of life for millions of people living there.
options(repos = c(CRAN = "https://cran.rstudio.com/"))
#TLA: Latin America & Caribbean (IDA & IBRD)
#TSA: South Asia (IDA & IBRD)
#SSA: Sub-Saharan Africa (excluding high income)
#TEC: Europe & Central Asia (IDA & IBRD)
#MEA: Middle East & North Africa
#TEA: East Asia & Pacific (IDA & IBRD)
access_electricity <- esg_vars_long
access_electricity$Year <- as.numeric(access_electricity$Year)
access_electricity <- esg_vars_long %>%
select(Year, Country.Code, Country.Name, EG.ELC.ACCS.ZS) %>%
filter(Year >= 2000 &
EG.ELC.ACCS.ZS != ".." &
Country.Code %in% c("TLA", "TSA", "SSA", "TEC", "MEA", "TEA")) %>%
arrange(Year)
p <- plot_ly(data = access_electricity, x = ~Year, y = ~EG.ELC.ACCS.ZS, type = 'scatter', mode = 'lines+markers', color = ~Country.Name)
htmlwidgets::saveWidget(as_widget(p), "plotly_chart.html")
#p <- plot_ly(data = access_electricity, x = ~Year, y = ~EG.ELC.ACCS.ZS,
#type = 'scatter', mode = 'lines+markers',
#color = ~Country.Name, text = ~paste("Access:", EG.ELC.ACCS.ZS, "%"),
#hoverinfo = 'text+x+y')
# Layout adjustments
p <- layout(p, title = 'Access to Electricity Over Time',
xaxis = list(title = 'Year'),
yaxis = list(title = 'Access to Electricity (%)'),
hovermode = ('closest'),
legend = list(font = list(size = 8),
xanchor = 'right',
yanchor = 'top',
bgcolor = 'rgba(255, 255, 255, 0.5)',
margin = list(r = 120, t = 50, b = 50, l = 50),
bordercolor = '#E2E2E2',
borderwidth = 1,
orientation = 'v'
))
# Render the plot
# Save the Plotly plot as a static image
#plotly::orca(p, file = "plotly_plot.png")
p
Why is the access to electricity so low in Sub-Saharan Africa?
options(repos = c(CRAN = "https://cran.rstudio.com/"))
access_electricity <- esg_vars_long
access_electricity$Year <- as.numeric(access_electricity$Year)
access_electricity_SA <- esg_vars_long %>%
select(Year, Country.Code, EG.ELC.ACCS.ZS) %>%
filter(Year >= 2000 &
EG.ELC.ACCS.ZS != ".." &
(Country.Code == "TSA" | Country.Code == "SSA")) %>%
arrange(Year)
access_electricity_SA <- esg_vars_long %>%
select(Year, Country.Name, EG.ELC.ACCS.ZS) %>%
filter(Year >= 2000 &
EG.ELC.ACCS.ZS != ".." &
Country.Name %in% c("Angola", "Benin", "Botswana", "Burkina Faso", "Burundi", "Cabo Verde", "Cameroon", "Central African Republic", "Chad", "Comoros", "Congo, Dem. Rep.", "Congo, Rep.", "Cote D'Ivoire", "Equatorial Guinea", "Eritrea", "Eswatini", "Ethiopia", "Gabon", "Gambia, The", "Ghana", "Guinea", "Guinea-Bissau", "Kenya", "Lesotho", "Liberia", "Madagascar", "Malawi", "Mali", "Mauritania", "Mauritius", "Mozambique", "Namibia", "Niger", "Nigeria", "Rwanda", "Sao Tome And Principe", "Senegal", "Sierra Leone", "Somalia", "South Africa", "South Sudan", "Sudan", "Tanzania", "Togo", "Uganda", "Zambia", "Zimbabwe"
))
# Load the world shapefiles
world <- ne_countries(scale = "medium", returnclass = "sf")
# Filter for only African countries
african_countries <- world[world$continent == "Africa", ]
# Merge data with the filtered shapefiles
electricity_map_data <- merge(african_countries, access_electricity_SA, by.x = "name", by.y = "Country.Name")
electricity_map_data$EG.ELC.ACCS.ZS <- as.numeric(as.character(electricity_map_data$EG.ELC.ACCS.ZS))
#Latest year data
latest_data <- electricity_map_data %>%
filter(Year == max(Year, na.rm = TRUE))
#Color
#palette_function <- colorNumeric(palette = "YlGnBu", domain = latest_data$EG.ELC.ACCS.ZS)
range_electricity <- range(electricity_map_data$EG.ELC.ACCS.ZS, na.rm = TRUE)
palette_function <- colorNumeric(palette = "YlGnBu", domain = range_electricity)
# Create the map
electricity_map <- leaflet(electricity_map_data) %>%
addTiles() %>%
addPolygons(
fillColor = ~palette_function(EG.ELC.ACCS.ZS),
color = "#BDBDC3",
fillOpacity = 0.7,
weight = 1,
popup = ~paste(name, ":", EG.ELC.ACCS.ZS, "%")
) %>%
addLegend(
position = "bottomright",
pal = palette_function,
values = ~EG.ELC.ACCS.ZS,
title = "Access to Electricity (%)",
opacity = 1
)
electricity_map <- electricity_map %>%
setView(lng = 20, lat = 0, zoom = 2.5)
electricity_map
Landlocked Central Africa
Despite the low average access to electricity, the disparities in
electricity access among countries in this area are more concerning.
Lower than 10% of the population in land-locked countries such as Niger
and Chad have the access to electricity, while the number countries such
as Gabon and South Africa is above 80%.
Land-locked areas usually face greater challenges in infrastructure
development. Limited transportation options will lead to higher costs of
the potential energy projects and longer-than-usual construction
period.
Additionally, land-locked areas generally have a larger underserved
community, which add on more initial costs of energy development
projects and maintenance cost in the subsequent years. Given the limited
financial resources, the substantial financial outlay is an extreme
burden for most of these land-locked countries.
options(repos = c(CRAN = "https://cran.rstudio.com/"))
library(esquisse)
library(ggplot2)
# Filter the data for TSA and SSA
tsa_ssa_data <- esg_vars_long %>%
select(Year, Country.Code, EG.ELC.ACCS.ZS, NY.GDP.MKTP.KD.ZG) %>%
filter(EG.ELC.ACCS.ZS != "..") %>%
filter(NY.GDP.MKTP.KD.ZG != "..") %>%
filter(Country.Code %in% c("TSA", "SSA"))
# Convert columns to numeric
tsa_ssa_data$Year <- as.numeric(tsa_ssa_data$Year)
tsa_ssa_data$NY.GDP.MKTP.KD.ZG <- as.numeric(tsa_ssa_data$NY.GDP.MKTP.KD.ZG)
# Check the data types again
str(tsa_ssa_data)
# Filter data for TSA
tsa_data <- tsa_ssa_data %>%
filter(Country.Code == "TSA")
# Filter data for SSA
ssa_data <- tsa_ssa_data %>%
filter(Country.Code == "SSA")
# Increase the size of the plot and points
options(repr.plot.width=10, repr.plot.height=6)
# Plot TSA and SSA with smoother lines
# Plot TSA and SSA with smoother lines
ggplot(tsa_ssa_data) +
aes(x = Year, y = NY.GDP.MKTP.KD.ZG, colour = Country.Code) +
geom_point(shape = 16, size = 1)+ # Use larger points
geom_smooth(data = tsa_data, aes(group = 1), method = "loess", se = FALSE, color = "coral", size = 1.5) +
geom_smooth(data = ssa_data, aes(group = 1), method = "loess", se = FALSE, color = "cornflowerblue", size = 1.5) +
labs(x = "Year", y = "GDP Growth", title = "Access to Electricity and GDP Growth Over Time") +
theme_minimal(base_size = 14) +
scale_colour_manual(values = c("TSA" = "coral", "SSA" = "cornflowerblue"),
labels = c("TSA" = "South Asia",
"SSA" = "Sub-Saharan Africa")) +
theme(axis.text = element_text(size = 10),
legend.title = element_blank(),
legend.text = element_text(size = 9))

In comparison to other regions, South Asia, despite its limited
resources and comprising mainly of developing countries, has
demonstrated remarkable growth over the past two decades. When comparing
the GDP growth and access to electricity between South Asia and
Sub-Saharan Africa, we osberve a clear positive correlation. South Asia
consistently exhibits a higher GDP growth rate alongside better access
to electricity than Sub-Saharan Africa. This trend suggests a stronger
economic growth in South Asia throughout this period. This correlation
is intuitive; access to energy serves as a key indicator of
productivity. Greater access to electricity, or other forms of energy,
signifies a region’s possession of more advanced technology and human
capital to facilitate the production of goods and services, therefore
driving higher economic growth. Thus, enhancing access to energy stands
as an indispensable initial step towards bolstering GDP growth.