The plot describes the frequency of violation by vehicle body types. There are mainly top 5 types of vehicle body at the top 5 ranking(unknown type excluded), which are SDN, PICK, 2DSD, 4DSD, SUBN. The type abbreviations are the exact match of the body type listed on the vehicle registration. The law defines a suburban(SUBN) as a vehicle that can be used to carry passengers and cargo. Other common body types and codes for vehicles registered in the passenger vehicle class are sedan (SDN), a two-door sedan (2DSD) and a four-door sedan (4DSD), pick-up trucks (PICK).
violation_df =
violation %>%
count(vehicle_body_type) %>%
mutate(
vehicle_body_type = fct_reorder(vehicle_body_type, n)
) %>%
filter(
vehicle_body_type !="NA",
n > 10000
) %>%
ggplot(aes(x = vehicle_body_type, y = n, fill = vehicle_body_type)) +
geom_bar(stat = "identity") +
labs(
title = "Frequency of Violation by Vehicle Body Type",
x = "Vehicle Body Types",
y = "Counts"
) +
geom_text(aes(label = n), position = position_dodge(width=0.9), vjust=-0.25)
violation_df