ggplot(delayed_summary, aes(x = avg_dep_delay, y = avg_arr_delay)) +geom_point(size =3, alpha = .7, color ="pink") +geom_smooth(se =FALSE, color ="orange") +theme_minimal() +labs(x ="Average Departure Delay (minutes)",y ="Average Arrival Delay (minutes)",title ="Relationship Between Departure and Arrival Delays",caption ="Source: FAA Aircraft Registry and nycflights23 dataset" )
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
The visualization I created represents the relationship between delayed departures and delayed arrival for a flight leaving New York. The data I used comes from the NYCflights23 dataset. The type of graph I chose for this specific assignment was a scatterplot because it is the one I’ve become the most accustomed to. I started by filtering out all blank or NA values from the arrival delay or departure delay. From there, I grouped all flights by the type of Airline, while calculating the average arrival delay and average departure delay. The scatterplot displays the average departure delay on the x-axis and the average arrival delay on the y-axis. One aspect I really like from the visualization is the relationship between delayed departure and arrival delay, as I didn’t think the two variables would have a positive relationship. This means that when a flight arrives late, it affects the flight’s schedule and makes it harder for the flight to arrive on time at a destination.