Created
September 20, 2018 00:08
-
-
Save dKvale/8ed4e9df4fae940182dccf992f88b33f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(albersusa) # devtools::install_github("hrbrmstr/albersusa") | |
| library(ggalt) # devtools::install_github("hrbrmstr/ggalt") | |
| library(hrbrthemes) # devtools::install_github("hrbrmstr/hrbrthemes") | |
| library(rrricanes) | |
| library(tidyverse) | |
| library(ggrepel) | |
| storms <- get_storms() | |
| strength <- | |
| c( | |
| "Subtropical Depression" = "#31688E", | |
| "Tropical Depression" = "#26828E", | |
| "Tropical Storm" = "#6DCD59", | |
| "Hurricane" = "#FDE725", | |
| "Post-Tropical Cyclone" = "#482878", | |
| "Remnants Of" = "#440154" | |
| ) # deliberate viridis-colormap selections | |
| # Get storm tracks | |
| mutate(storms, track = map(Link, get_storm_data, products="fstadv")) %>% | |
| unnest(track) %>% | |
| unnest(track) %>% | |
| mutate(Status = factor(Status, levels=names(strength))) %>% | |
| arrange(Date) -> | |
| tracks | |
| # Get world map | |
| wrld <- tbl_df(map_data("world")) | |
| # Plot black map | |
| ggplot() + | |
| geom_cartogram( | |
| data = wrld, | |
| map = wrld, | |
| aes(long, lat, map_id = region), | |
| fill = alpha("lightgray", 1/10), | |
| color = alpha("white", 1/2), | |
| size = 0.065 | |
| ) + | |
| geom_path( | |
| data = tracks, aes(Lon, Lat, group = Name, color = Status), | |
| size = 1, alpha=1/2 | |
| ) + | |
| #geom_text_repel( | |
| # data = tracks %>% group_by(Name) %>% sample_n(1), | |
| # aes(Lon, Lat, label = Name), | |
| # color = alpha("white", 1/2), size = 3 | |
| #) + | |
| coord_proj(us_aeqd_proj) + # swap these two lines for globe/zoom | |
| #coord_proj(us_aeqd_proj, xlim = c(-145, -30), ylim = c(5,60)) + | |
| scale_color_manual(name = NULL, values = strength) + | |
| labs( | |
| x = NULL, y = NULL, | |
| title = "2018 NOAA Named Tropical Storms (Atlantic/East Pacific)" | |
| ) + | |
| theme_ft_rc(grid = "") + | |
| theme(axis.text = element_blank()) + | |
| theme(legend.position = "bottom") | |
| ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment