Load Libraries

library(ggplot2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
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
library(readr)

Load Dataset

ev_data <- read.csv("ev_data.csv")

head(ev_data)
##   Year       State Vehicle_Type EV_Registrations Charging_Stations Fuel_Price
## 1 2020   Karnataka           2W            53726              1148      89.97
## 2 2020   Karnataka           3W            31435                70     107.06
## 3 2020   Karnataka           4W            35917               155     100.57
## 4 2020   Karnataka          Bus            53102                51      96.00
## 5 2020 Maharashtra           2W            22911              1392      86.39
## 6 2020 Maharashtra           3W            48000              1428      89.05
##   Market_Share Population_Million Growth_Percentage
## 1        20.53               27.6             38.07
## 2         2.95               76.8             20.21
## 3        26.15               41.7             17.25
## 4        19.09               77.1             17.18
## 5        28.13               17.0             44.50
## 6         3.56               60.0             32.95

Visualization 1: Line Chart

year_data <- ev_data %>%
group_by(Year) %>%
summarise(Total_EV=sum(EV_Registrations))

ggplot(year_data,
aes(x=Year,y=Total_EV))+

geom_line(linewidth=1)+
geom_point(size=3)+

labs(
title="Growth of EV Registrations in India Over Time",
x="Year",
y="EV Registrations"
)

Visualization 2: Bar Chart

state_data <- ev_data %>%
group_by(State) %>%
summarise(Total=sum(EV_Registrations))

ggplot(state_data,
aes(x=reorder(State,Total),
y=Total))+

geom_bar(stat="identity")+
coord_flip()+

labs(
title="Top States by EV Registrations",
x="State",
y="Total Registrations"
)

Visualization 3: Pie Chart

vehicle_data <- ev_data %>%
group_by(Vehicle_Type) %>%
summarise(Total=sum(EV_Registrations))

ggplot(vehicle_data,
aes(
x="",
y=Total,
fill=Vehicle_Type
))+

geom_bar(
width=1,
stat="identity"
)+

coord_polar("y")+

labs(
title="Distribution of EV Vehicle Categories"
)

Visualization 4: Heatmap

heat_data <- ev_data %>%
group_by(State,Year) %>%
summarise(
Total=sum(EV_Registrations)
)
## `summarise()` has regrouped the output.
## ℹ Summaries were computed grouped by State and Year.
## ℹ Output is grouped by State.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(State, Year))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.
ggplot(
heat_data,
aes(
x=Year,
y=State,
fill=Total
)
)+

geom_tile()+

labs(
title="State-wise EV Adoption Density",
x="Year",
y="State"
)

Visualization 5: Box Plot

ggplot(
ev_data,
aes(
x=Vehicle_Type,
y=EV_Registrations,
fill=Vehicle_Type
)
)+

geom_boxplot()+

labs(
title="Distribution of EV Registrations Across Vehicle Types",
x="Vehicle Type",
y="Registrations"
)

Visualization 6: Scatter Plot

ggplot(
ev_data,
aes(
x=Charging_Stations,
y=EV_Registrations
)
)+

geom_point()+
geom_smooth(method="lm")+

labs(
title="Charging Stations vs EV Registrations",
x="Charging Stations",
y="EV Registrations"
)
## `geom_smooth()` using formula = 'y ~ x'

Visualization 7: Stacked Bar Chart

ggplot(
ev_data,
aes(
x=State,
y=EV_Registrations,
fill=Vehicle_Type
)
)+

geom_bar(stat="identity")+

labs(
title="Vehicle Type Contribution by State",
x="State",
y="Registrations"
)

Visualization 8: Interactive Plotly Chart

p <- ggplot(
ev_data,
aes(
x=Year,
y=EV_Registrations,
color=State
)
)+

geom_line()+

labs(
title="Interactive EV Growth Dashboard",
x="Year",
y="EV Registrations"
)

ggplotly(p)

Conclusion

Electric vehicle adoption in India shows significant growth across years. Different states and vehicle categories contribute differently to the EV ecosystem, and charging infrastructure appears related to adoption rates.