knitr::opts_chunk$set(echo = TRUE, fig.align = "center")
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2) library(HURDAT) library(knitr) library(purrr) library(rrricanes) library(rrricanesdata) library(sp) library(stringr) library(tibble)
gis <- flatten(gis_latest(verbose = FALSE))
pts <- as_data_frame(gis$AL112017_pts) lin <- shp_to_df(gis$AL112017_lin) windswath <- shp_to_df(gis$AL112017_windswath) radii <- shp_to_df(gis$AL112017_radii) initial_radii <- shp_to_df(gis$al112017_2017090409_initialradii) fcst_radii <- shp_to_df(gis$al112017_2017090409_forecastradii) fcst_pts <- as_data_frame(gis$al112017_020_5day_pts) fcst_lin <- shp_to_df(gis$al112017_020_5day_lin) fcst_cone <- shp_to_df(gis$al112017_020_5day_pgn)
l <- list("bbox.pts" = bbox(gis$AL112017_pts), "bbox.lin" = bbox(gis$AL112017_lin), "bbox.windswath" = bbox(gis$AL112017_windswath), "bbox.radii" = bbox(gis$AL112017_radii), "bbox.initial_radii" = bbox(gis$al112017_2017090309_initialradii), "bbox.fcst_radii" = bbox(gis$al112017_2017090309_forecastradii), "bbox.fcst_pts" = bbox(gis$al112017_016_5day_pts), "bbox.fcst_lin" = bbox(gis$al112017_016_5day_lin), "bbox.fcst_cone" = bbox(gis$al112017_016_5day_pgn)) bb <- matrix(c(map(l, `[[`, 1) %>% flatten_dbl() %>% min(), map(l, `[[`, 2) %>% flatten_dbl() %>% max()), nrow = 2, ncol = 2)
# Current and past details plot_lin <- geom_path(data = lin, aes(x = long, y = lat, color = STORMTYPE)) plot_pts <- geom_point(data = pts, aes(x = LON, y = LAT, color = STORMTYPE, size = INTENSITY)) # Forecast details plot_fcst_lin <- geom_path(data = fcst_lin, aes(x = long, y = lat, color = STORMTYPE)) plot_fcst_pts <- geom_point(data = fcst_pts, aes(x = LON, y = LAT, color = STORMTYPE, size = MAXWIND)) # Forecast cone plot_fcst_cone <- geom_polygon(data = fcst_cone, aes(x = long, y = lat, group = group, fill = FCSTPRD), alpha = 0.25) # Wind radii details plot_initial_radii <- geom_polygon(data = initial_radii, aes(x = long, y = lat, group = group, fill = factor(RADII)), alpha = 0.25)
tracking_chart(color = "black", fill = "white", size = 0.1, res = 50) + plot_lin + plot_pts + plot_fcst_lin + plot_fcst_pts + plot_fcst_cone + coord_equal(xlim = c(-80, -16), ylim = c(11.5, 25)) + theme(legend.position = "bottom", legend.direction = "vertical")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.