# A tibble: 6 × 9
dest month_name week_day month_week count avg_dist avg_arr_delay
<chr> <chr> <ord> <dbl> <int> <dbl> <dbl>
1 ABQ June Thu 2 1 1826 -76
2 PSP April Tue 2 1 2378 -76
3 SJC June Thu 2 1 2569 -76
4 BUR April Tue 2 1 2465 -75
5 SJC June Tue 2 1 2569 -74
6 PSP December Tue 4 2 2378 -69
# ℹ 2 more variables: avg_dep_delay <dbl>, avg_total_delay <dbl>
Facted Heatmap
ggplot(by_dest, aes(x =as.character(month_week), y = week_day, fill = avg_dist)) +geom_tile(color ="white") +facet_wrap(~ month_name, nrow =3, scales ="free") +scale_fill_gradient(low ="#f0cb35", high ="#c02425") +xlab("Week of Month") +ylab("Days of Week") +labs(fill ="Avg distance", caption ="Source: New York Flights Data", title ="Faceted Heatmap") +theme_minimal() +theme(panel.grid.major =element_blank(),panel.border =element_blank(),strip.text =element_text(size =12),plot.caption =element_text(hjust =0.5, size =9), plot.title =element_text(hjust=0.5, size =11) )
Reflection
This is a heatmap of every month and day, displaying the average flight distances in New York. One notable feature is that certain days and months appear darker on the map, representing greater distances travelled, while lighter colors represent less distance travelled. Another noticeable detail is that each month has its own set of days beside it; this is due to adding scales = ‘free’ in the facet_wrap function, which makes the map much easier to read and interpret. One major issue I encountered was getting the months to appear in chronological order. I also applied a minimal theme to keep viewers more focused on the map, without being distracted by surrounding letters.The darker spots are consistent throughout the map, but people seem to travel the farthest during the spring break period (March to April). Overall, this map highlights patterns in flight distance across different times of the year.