library(readxl)
ev_in_general <- read_excel("~/Desktop/ev in general.xlsx")
View(ev_in_general)final project_24 spring
Analysis of EV Sales Data and Investment Trends in Sustainable Finance
Introduction
The electric vehicle(EV) is defined as a vehicle that can be powered by an electric motor that draws electricity from a battery and is capable of being charged from an external source. Since the first EV was created more than 100 years ago, the number of EV is seeing a rapidly increase in current days. Analyzing electric vehicle (EV) sales is essential for understanding investment patterns in sustainable finance, as it highlights consumer adoption and market trends crucial for investment decisions. This project seeks to find how do EV sales by country influence investments in sustainable finance. And the analyzed data is from Bloomberg and describes the quarterly sales of EV by country in the recent five years.
Market Development Trend
total_values <- ev_in_general[ev_in_general$Country == "Total", -1]
quarters <- colnames(ev_in_general)[-1]
plot_data <- data.frame(Quarter = quarters, Total = as.numeric(total_values))library(ggplot2)
ggplot(plot_data) +
aes(x = Quarter, y = Total, colour = Quarter) +
geom_point(shape = "circle", size = 1.5) +
geom_line() +
scale_color_hue(direction = 1) +
labs(
x = "Quarter",
title = "Trend of EV Total Sales in recent five years",
caption = "Sophia Wang"
) +
theme_minimal()`geom_line()`: Each group consists of only one observation.
ℹ Do you need to adjust the group aesthetic?

Firstly, in order to find the total market trend of the global EV market, I have created a scatterplot for total EV sales in the past five years. This graph displays the trend of Electric Vehicle (EV) total sales over a span of five years, categorized by quarters. The x-axis represents time, segmented into quarters for each year from 2019 to 2023, while the y-axis shows the total number of EVs sold, with values ranging from 0 to over 4 million. From the graph, we can discern a general upward trend in sales, with the numbers rising significantly from 2019 to 2023. Sales fluctuations within each year are visible, indicating seasonal trends or other market influences affecting quarterly sales. The graph also suggests an increasing consumer shift towards electric vehicles over the given time frame, which could be attributed to a growing environmental consciousness, improvements in EV technology, or more supportive government policies. The last quarter on the graph, 2023 Q4, appears to have the highest sales, demonstrating a strong end-of-year performance.
2023 Market Performance
While global trends provide a broad understanding of EV adoption, analyzing electric vehicle sales by individual countries is essential to fully comprehend the diverse market dynamics within the sector. Country-specific analysis allows for the identification of unique drivers and barriers to EV adoption, ranging from government incentives and infrastructure readiness to consumer behavior patterns. It can also uncover insights into regional disparities, pinpointing where investments and policy interventions could be most effective. Below is a heat map that presents a detailed, country-by-country breakdown of EV sales for 2023, offering potential investment opportunities for stakeholders.
new_df<- data.frame(ev_in_general$"Country",ev_in_general$"2023Q4" + ev_in_general$"2023Q3" + ev_in_general$"2023Q2" + ev_in_general$"2023Q1")
names(new_df) <- c("Country", "Total_2023")
library(countrycode)
new_df$Country <- as.character(new_df$Country)
heat_data <- countrycode(new_df$Country, origin = "country.name", destination = "iso3c")Warning: Some values were not matched unambiguously: Total, Unspecified
heat_df<- data.frame(heat_data, new_df)
names(heat_df) <- c("iso3","Country", "Total_2023")library(leaflet)
library(rnaturalearth)
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
world <- ne_countries(scale = "medium", returnclass = "sf")
world_data <- world %>%
left_join(heat_df, by = c("iso_a3" = "iso3")) # Change "name" to "iso_a3"
pal <- colorNumeric(palette = "viridis", domain = world_data$Total_2023)
leaflet(world_data) %>%
addProviderTiles(providers$CartoDB.Positron) %>%
addPolygons(fillColor = ~pal(Total_2023),
fillOpacity = 0.7,
color = "#000000",
weight = 0.2,
smoothFactor = 0.5,
highlightOptions = highlightOptions(weight = 3,
color = "#666",
fillOpacity = 0.7,
bringToFront = TRUE)) %>%
addLegend(pal = pal, values = ~Total_2023, title = "Total 2023", opacity = 1)The heatmap of 2023 total electric vehicle (EV) sales by country presents a compelling visual of global market distributions and investment opportunities in sustainable transportation. The use of a darker purple to indicate higher sales reveals that the greatest number of EVs sold is centered in Asia, with a particularly high volume in China as indicated by the yellow shading. This signifies China’s dominant market position, likely driven by robust government policies, technological advancements, and manufacturing capabilities. North America also shows a significant adoption rate, with the United States presumably leading in sales, suggested by the solid purple color. The variation in purple hues across Europe highlights the region’s commitment to sustainable transportation, with certain countries, potentially like Norway and the Netherlands, outperforming others based on their lighter shading. The map shows minimal sales across Africa, South America, and parts of Asia, as denoted by the grey ‘NA’ for not available or minimal data, highlighting regions where EV market penetration is either nascent or data collection is limited.
Major Stakeholder’s Performance
The performance of China is specifically examined due to its significant role in the global EV market, characterized by high sales volumes and rapid growth. As a major player, understanding China’s market dynamics offers insights into broader trends in EV adoption and manufacturing capabilities. To visualize these trends, I have created a line graph that charts the quarterly EV sales in China from 2019 to 2023. This graph highlights the sales trends, including notable increases and the factors influencing these fluctuations, providing a clear picture of how China is shaping the global shift towards sustainable transportation.
library(ggplot2)
country_name <- "China"
country_data <- subset(ev_in_general, Country == country_name)
country_data_long <- reshape2::melt(country_data, id.vars = "Country", variable.name = "Quarter", value.name = "Sales")
country_data_long$Year <- as.integer(gsub("^([0-9]+)Q[0-9]+$", "\\1", country_data_long$Quarter))
country_data_long$Quarter <- as.integer(gsub("^[0-9]+Q([0-9]+)$", "\\1", country_data_long$Quarter))
country_data_long$Quarter <- as.Date(paste(country_data_long$Year, country_data_long$Quarter, "01", sep = "-"))
ggplot(country_data_long, aes(x = Quarter, y = Sales, color = Country)) +
geom_line(size = 1) +
labs(title = paste("Quarterly EV Sales Over Time for", country_name),
x = "Quarter",
y = "Sales",
color = "Country") +
theme_minimal() +
theme(plot.title = element_text(size = 16, face = "bold"),
axis.title = element_text(size = 14),
axis.text = element_text(size = 12),
legend.title = element_text(size = 12),
legend.text = element_text(size = 10))Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.

This graph illustrates the quarterly electric vehicle (EV) sales in China from 2019 to 2023, showing a generally upward trend. Initial sales show a moderate increase through 2019 and 2020. Notably, there is a sharp rise from 2020 to 2021, indicating a significant increase in demand or policy-driven sales incentives. However, this is followed by a sudden decrease, possibly because of external factors such as supply chain issues or the pandemic of COVID-19. The rebound in subsequent quarters suggests a strong recovery, culminating in a steep increase toward the end of 2023. This peak may reflect an accelerated adoption of EVs, potentially driven by increased consumer awareness, government subsidies, or advancements in EV technology. The overall trend signifies robust growth in the EV market in China, and highlight the country’s growing importance in the global shift towards sustainable transportation.
Conclusion
The comprehensive analysis of electric vehicle (EV) sales data over the past five years highlights a significant global shift towards sustainable transportation, driven by consumer awareness, technological advancements, and supportive government policies. The data reveals robust growth in regions like China and the U.S. while identifying untapped potential in areas like Africa and South America. This trend underscores the increasing importance of EVs in sustainable finance, offering valuable insights for stakeholders to align investments with environmental strategies.