ggplot(delayed_flights, aes(x = origin, y = total_delays, fill = delay_group)) +geom_col() +scale_fill_brewer(palette ="Purples") +scale_x_discrete(labels =function(x) stringr::str_wrap(x, width =12)) +labs( x ="Origin Airport", y ="Number of Delayed Arrivals", title ="Delayed Arrivals by Airport and Delay Duration (NYC, 2023)", caption ="Source: nycflights23 dataset", fill ="Amount Delayed" ) +theme_minimal() +theme(axis.text.x =element_text(angle =0))
I have made a bar graph showing how many time a flight that came from a specific airport was delayed (arrival), and by how much time it ended up being delayed. I listed the three airports on the x-axis and then the number of times on the y-axis, using different color sections inside each bar to show the amount of time. I think I nice thing about this graph is you can easily see which airport has the most delays and a estimate on the percentage of how the light was delayed. For this project, I ended up using Google to search how to connect all of my specific arguments in the the first chunk. I types into Google “how to connect arguments when filtering data in r studio” to see how to put everything together in the first part of my code. I have edited everything to be on the next line so the code is not in one big line.