library(ggplot2)
library(scales)
data_set<-read.csv("airline_stats.csv")
head(data_set)
## pct_carrier_delay pct_atc_delay pct_weather_delay airline
## 1 8.153226 1.971774 0.7620968 American
## 2 5.959924 3.706107 1.5858779 American
## 3 7.157270 2.706231 2.0267062 American
## 4 12.100000 11.033333 0.0000000 American
## 5 7.333333 3.365591 1.7741935 American
## 6 6.163889 3.225000 0.9750000 American
ggplot(data_set, aes(
x = reorder(airline, -pct_weather_delay),
y = pct_weather_delay,
fill = airline)) +
geom_col(width = 0.6, show.legend = FALSE) +
scale_y_continuous(
name = "Weather Delay (%)",
) +
labs(
title = "Weather Delay Percentage by Airline",
subtitle = "Comparison of weather-related delays among major airlines",
x = "Airline",
caption = "Data Source: airline_stats.csv"
) +
theme_minimal(base_size = 14) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
## Warning: Removed 28 rows containing missing values or values outside the scale range
## (`geom_col()`).
This column chart reveals which airlines experience the highest percentage of delays due to weather. American Airlines shows the highest weather delay rate, and the lowest is by Jet Blue.