Overview

Historic data indicates that the occurrence and intensity of cyclonic storms (Hurricanes, Typhoons and Tornados) increases with the increased earth temperature. For this assignment you will need to tell this story to a non-technical audience (eg: a high-school earth science class).

Notes:

Source historic data for a period of at least 25 years on a measure of the earth’s temperature.

Source data on the occurrence and intensity of hurricanes, typhoons and tornados for the same historic period.

Perform the data analysis to establish the correlations between earth temperature and storm occurrence and intensity.

Tell the story of this data and your analysis using data visualizations and other illustrations (eg: pictures of storm damage) in a presentation that will be accessible to a high-school earth science class.

This assignment is due at the end of the week ten of the semester.

Data Sources

Load Libraries

Read in Data

# Read in the data
storm_events_2025 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2025_c20250818.csv")
storm_events_2024 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2024_c20250818.csv")
storm_events_2023 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2023_c20250731.csv")
storm_events_2022 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2022_c20250721.csv")
storm_events_2021 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2021_c20250520.csv")
storm_events_2020 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2020_c20250702.csv")
storm_events_2019 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2019_c20250520.csv")
storm_events_2018 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2018_c20250520.csv")
storm_events_2017 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2017_c20250520.csv")
storm_events_2016 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2016_c20250818.csv")
storm_events_2015 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2015_c20250818.csv")
storm_events_2014 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2014_c20250520.csv")
storm_events_2013 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2013_c20250520.csv")
storm_events_2012 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2012_c20250520.csv")
storm_events_2011 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2011_c20250520.csv")
storm_events_2010 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2010_c20250520.csv")
storm_events_2009 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2009_c20250520%20(1).csv")
storm_events_2008 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2008_c20250520.csv")
storm_events_2007 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2007_c20250520.csv")
storm_events_2006 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2006_c20250520.csv")
storm_events_2005 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2005_c20250520.csv")
storm_events_2004 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2004_c20250520.csv")
storm_events_2003 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2003_c20250520.csv")
storm_events_2002 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2002_c20250520.csv")
storm_events_2001 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2001_c20250520.csv")
storm_events_2000 <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/StormEvents_details-ftp_v1.0_d2000_c20250520.csv")

hurricanes_1800s_1900s <- read.csv("https://github.com/gillianmcgovern0/cuny-data-608/raw/refs/heads/main/cyclones_fig-1.csv", skip = 6)
earth_temp <- read.csv("https://raw.githubusercontent.com/gillianmcgovern0/cuny-data-608/refs/heads/main/data_earth_temp.csv", skip = 3)
power_dissipation_index <- read.csv("https://github.com/gillianmcgovern0/cuny-data-608/raw/refs/heads/main/cyclones_fig-3.csv", skip = 6)

Clean the Data

colnames(power_dissipation_index) <- c("year", "smoothed_sst_f", "smoothed_pdi")
power_dissipation_index <- power_dissipation_index %>% drop_na()
power_dissipation_index_v1 <- power_dissipation_index |>
  filter(year >= 2000) |>
  dplyr::select(c(year, smoothed_pdi))
earth_temp$year <- as.numeric(substr(earth_temp$Date, 1, 4))
earth_temp$month <- as.numeric(substr(earth_temp$Date, 5, 6))

earth_temp_v1 <- earth_temp %>%
      group_by(year) %>%
      summarise(anomaly_mean = mean(Anomaly))
colnames(hurricanes_1800s_1900s) <- c("year", "total_hurricanes_adjusted_smoothed", "total_hurricanes_unadjusted_smoothed", "hurricanes_reaching_united_states_smoothed")
storms_events_25_yrs <- rbind(storm_events_2025, storm_events_2024, storm_events_2023, storm_events_2022, storm_events_2021, storm_events_2020, storm_events_2019, storm_events_2018, storm_events_2017, storm_events_2016, storm_events_2015, storm_events_2014, storm_events_2013, storm_events_2012, storm_events_2011, storm_events_2010, storm_events_2009, storm_events_2008, storm_events_2007, storm_events_2006, storm_events_2005, storm_events_2004, storm_events_2003, storm_events_2002, storm_events_2001, storm_events_2000)
storms_events_25_yrs_v1 <- storms_events_25_yrs |>
  dplyr::select(YEAR, MONTH_NAME, EVENT_ID, EVENT_TYPE, MAGNITUDE, MAGNITUDE_TYPE, TOR_F_SCALE, EPISODE_ID)
storms_events_25_yrs_v1 <- storms_events_25_yrs_v1 |>
  filter(EVENT_TYPE %in% c("Tornado", "Marine Hurricane/Typhoon", "Hurricane (Typhoon)"))
head(storms_events_25_yrs)
##   BEGIN_YEARMONTH BEGIN_DAY BEGIN_TIME END_YEARMONTH END_DAY END_TIME
## 1          202503        31       1104        202503      31     1106
## 2          202503        30       1552        202503      30     1555
## 3          202501         5       1800        202501       6     2227
## 4          202501         3       1300        202501       3     1900
## 5          202501         3       1300        202501       3     1900
## 6          202501         3       1300        202501       3     1900
##   EPISODE_ID EVENT_ID    STATE STATE_FIPS YEAR MONTH_NAME        EVENT_TYPE
## 1     201366  1252415  GEORGIA         13 2025      March Thunderstorm Wind
## 2     200337  1241136 MICHIGAN         26 2025      March           Tornado
## 3     197733  1222851 VIRGINIA         51 2025    January      Winter Storm
## 4     197761  1223112 MARYLAND         24 2025    January    Winter Weather
## 5     197761  1223113 MARYLAND         24 2025    January    Winter Weather
## 6     197761  1223114 MARYLAND         24 2025    January    Winter Weather
##   CZ_TYPE CZ_FIPS                          CZ_NAME WFO    BEGIN_DATE_TIME
## 1       C      45                          CARROLL FFC 31-MAR-25 11:04:00
## 2       C      27                             CASS IWX 30-MAR-25 15:52:00
## 3       Z      56                     SPOTSYLVANIA LWX 05-JAN-25 18:00:00
## 4       Z     506     CENTRAL AND SOUTHEAST HOWARD LWX 03-JAN-25 13:00:00
## 5       Z     504 CENTRAL AND SOUTHEAST MONTGOMERY LWX 03-JAN-25 13:00:00
## 6       Z     503             NORTHWEST MONTGOMERY LWX 03-JAN-25 13:00:00
##   CZ_TIMEZONE      END_DATE_TIME INJURIES_DIRECT INJURIES_INDIRECT
## 1       EST-5 31-MAR-25 11:06:00               0                 0
## 2       EST-5 30-MAR-25 15:55:00               0                 0
## 3       EST-5 06-JAN-25 22:27:00               0                 0
## 4       EST-5 03-JAN-25 19:00:00               0                 0
## 5       EST-5 03-JAN-25 19:00:00               0                 0
## 6       EST-5 03-JAN-25 19:00:00               0                 0
##   DEATHS_DIRECT DEATHS_INDIRECT DAMAGE_PROPERTY DAMAGE_CROPS            SOURCE
## 1             0               0           1.00K              Emergency Manager
## 2             0               0         100.00K        0.00K  NWS Storm Survey
## 3             0               0                                Trained Spotter
## 4             0               0                                Trained Spotter
## 5             0               0                                Trained Spotter
## 6             0               0                                Trained Spotter
##   MAGNITUDE MAGNITUDE_TYPE FLOOD_CAUSE CATEGORY TOR_F_SCALE TOR_LENGTH
## 1        52             EG                   NA                     NA
## 2        NA                                  NA         EF1       2.59
## 3        NA                                  NA                     NA
## 4        NA                                  NA                     NA
## 5        NA                                  NA                     NA
## 6        NA                                  NA                     NA
##   TOR_WIDTH TOR_OTHER_WFO TOR_OTHER_CZ_STATE TOR_OTHER_CZ_FIPS
## 1        NA                                                 NA
## 2       100                                                 NA
## 3        NA                                                 NA
## 4        NA                                                 NA
## 5        NA                                                 NA
## 6        NA                                                 NA
##   TOR_OTHER_CZ_NAME BEGIN_RANGE BEGIN_AZIMUTH BEGIN_LOCATION END_RANGE
## 1                             2             W           TYUS         2
## 2                             1            SW    EDWARDSBURG         1
## 3                            NA                                     NA
## 4                            NA                                     NA
## 5                            NA                                     NA
## 6                            NA                                     NA
##   END_AZIMUTH END_LOCATION BEGIN_LAT BEGIN_LON END_LAT END_LON
## 1           W         TYUS   33.4757   -85.238 33.4757 -85.238
## 2         NNE  EDWARDSBURG   41.7900   -86.100 41.8200 -86.070
## 3                                 NA        NA      NA      NA
## 4                                 NA        NA      NA      NA
## 5                                 NA        NA      NA      NA
## 6                                 NA        NA      NA      NA
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              EPISODE_NARRATIVE
## 1                                                                                                                                                                                                                                                                                                                                                                                           A cold-front initiated a line of thunderstorms across north and central GA through the afternoon hours of the 31st. Storms brought damaging winds along the I20 corridor and south as well as six quick spin-up tornadoes. The strongest being an EF1 between McDonough and Stockbridge crossing Hwy 75. There were also a couple reports of quarter size hail southeast of Macon.
## 2                                                                                                                                                                                                                                                                                                                                                                                                                                                   A cold front pushed into the area during the afternoon and evening hours, interacting with  decent shear and MLCAPE to allow for numerous thunderstorm development. Pockets of damaging winds occurred along with a total of six confirmed tornadoes (three in far southern Lower Michigan and three in northern Indiana).
## 3 An area of low pressure tracked across southern Virginia bringing the first widespread accumulating snow of the season. Snow overspread the area during the late evening hours of January 5th into the overnight. Snow overspread the area during the late evening hours of January 5th into the overnight. This continued steady through mid-morning. A lull occurred during the afternoon with a few snow showers. Another round of snow on the back side of the upper level low moved in during the evening bringing additional accumulations. This resulted in a swath of 6 to 12 inches of snow, with the higher totals in the northern Shenandoah Valley east towards Prince William County. Winds gusted to 45 mph resulting in blowing snow at the end of the storm.
## 4                                                                                                                                                                                                                                                                                                                                                                                                                                   An area of low pressure moved off into New England bringing a cold front through Maryland. Upslope snow showers and squalls ensued in western Maryland bringing accumulations of six to ten inches. Snow showers and squalls along the front impacted portions of the rest of the state bringing accumulations of a coating to two inches.
## 5                                                                                                                                                                                                                                                                                                                                                                                                                                   An area of low pressure moved off into New England bringing a cold front through Maryland. Upslope snow showers and squalls ensued in western Maryland bringing accumulations of six to ten inches. Snow showers and squalls along the front impacted portions of the rest of the state bringing accumulations of a coating to two inches.
## 6                                                                                                                                                                                                                                                                                                                                                                                                                                   An area of low pressure moved off into New England bringing a cold front through Maryland. Upslope snow showers and squalls ensued in western Maryland bringing accumulations of six to ten inches. Snow showers and squalls along the front impacted portions of the rest of the state bringing accumulations of a coating to two inches.
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              EVENT_NARRATIVE
## 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Tree down at the intersection of highway 5 and old columbus road.
## 2 A brief EF-1 tornado was confirmed in Edwardsburg, MI on March 30th, 2025. The tornado started in a field west of Conrad Rd, snapping and uprooting trees as it moved northeast towards the Edwardsburg Primary School, where EF-0 damage was noted. The tornado continued to the northeast and intensified, where several homes and businesses sustained damage on the east side of Pleasant Lake. The Starboard Choice Marina building sustained roof damage, a boat lift and dock were removed from the lake and flipped over, and a few boats were damaged as well, including one that was flipped and lifted over a fence. The most intense damage was seen along Dailey Road, where numerous large trees were snapped and uprooted, with estimated peak wind speeds of 90 mph. Overall, the tornado was on the ground for 3 minutes and had a peak intensity of EF-1. There were also areas of straight-line wind damage noted throughout Edwardsburg, indicative that the tornado was likely embedded within the line of storms that moved through.
## 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
## 4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
## 5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
## 6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
##   DATA_SOURCE
## 1         CSV
## 2         CSV
## 3         CSV
## 4         CSV
## 5         CSV
## 6         CSV
anyDuplicated(storms_events_25_yrs$EVENT_ID)
## [1] 0
storms_events_25_yrs_hurricane_typhoons<- storms_events_25_yrs_v1 %>%
 filter(EVENT_TYPE %in% c("Hurricane (Typhoon)"))
storms_events_25_yrs_tornadoes<- storms_events_25_yrs_v1 %>%
 filter(EVENT_TYPE %in% c("Tornado"))
head(storms_events_25_yrs_tornadoes)
##   YEAR MONTH_NAME EVENT_ID EVENT_TYPE MAGNITUDE MAGNITUDE_TYPE TOR_F_SCALE
## 1 2025      March  1241136    Tornado        NA                        EF1
## 2 2025   February  1258884    Tornado        NA                        EF0
## 3 2025   February  1258883    Tornado        NA                        EF1
## 4 2025      March  1241486    Tornado        NA                        EF0
## 5 2025      March  1241462    Tornado        NA                        EF1
## 6 2025      March  1241484    Tornado        NA                        EF0
##   EPISODE_ID
## 1     200337
## 2     198525
## 3     198525
## 4     200396
## 5     200396
## 6     200396
storms_events_25_yrs_tornadoes <- storms_events_25_yrs_tornadoes |>
  mutate(TOR_F_SCALE_VALUE = as.numeric(gsub("[^0-9]", "", TOR_F_SCALE)))
head(storms_events_25_yrs_tornadoes)
##   YEAR MONTH_NAME EVENT_ID EVENT_TYPE MAGNITUDE MAGNITUDE_TYPE TOR_F_SCALE
## 1 2025      March  1241136    Tornado        NA                        EF1
## 2 2025   February  1258884    Tornado        NA                        EF0
## 3 2025   February  1258883    Tornado        NA                        EF1
## 4 2025      March  1241486    Tornado        NA                        EF0
## 5 2025      March  1241462    Tornado        NA                        EF1
## 6 2025      March  1241484    Tornado        NA                        EF0
##   EPISODE_ID TOR_F_SCALE_VALUE
## 1     200337                 1
## 2     198525                 0
## 3     198525                 1
## 4     200396                 0
## 5     200396                 1
## 6     200396                 0
# Get hurricane/typhoon + tornado count df
storms_events_25_yrs_v1_summarise <- storms_events_25_yrs_v1 %>%
      group_by(YEAR, EPISODE_ID) %>%
      summarise(Count = n())
## `summarise()` has grouped output by 'YEAR'. You can override using the
## `.groups` argument.
storms_events_25_yrs_summarise_v2 <- storms_events_25_yrs_v1_summarise %>%
      group_by(YEAR) %>%
      summarise(Count = n())

colnames(storms_events_25_yrs_summarise_v2) <- c("year", "total_hurricane_typhoons_tornadoes_count")
# Tornadoes
storms_events_25_yrs_tornadoes_summarise <- storms_events_25_yrs_tornadoes %>%
      group_by(YEAR, EPISODE_ID) %>%
      summarise(Count = n())
## `summarise()` has grouped output by 'YEAR'. You can override using the
## `.groups` argument.
storms_events_25_yrs_tornadoes_summarise_v2 <- storms_events_25_yrs_tornadoes_summarise %>%
      group_by(YEAR) %>%
      summarise(Count = n())
# Group by episode

storms_events_25_yrs_hurricane_typhoons_summarise <- storms_events_25_yrs_hurricane_typhoons %>%
      group_by(YEAR, EPISODE_ID) %>%
      summarise(Count = n())
## `summarise()` has grouped output by 'YEAR'. You can override using the
## `.groups` argument.
storms_events_25_yrs_hurricane_typhoons_summarise
## # A tibble: 197 × 3
## # Groups:   YEAR [24]
##     YEAR EPISODE_ID Count
##    <int>      <int> <int>
##  1  2000    1100642     1
##  2  2000    1102750    13
##  3  2000    1102751     2
##  4  2000    1103431     1
##  5  2000    1103646    10
##  6  2000    1104015    15
##  7  2001    1122622     1
##  8  2001    1124515     3
##  9  2001    1124518     3
## 10  2001    1125744     1
## # ℹ 187 more rows
# Find total count
storms_events_25_yrs_hurricane_typhoons_summarise_v2 <- storms_events_25_yrs_hurricane_typhoons_summarise %>%
      group_by(YEAR) %>%
      summarise(Count = n())
hurricanes_1880_1999 <- hurricanes_1800s_1900s |>
  filter(year < 2000)
hurricanes_2000s_later <- hurricanes_1800s_1900s |>
  filter(year >= 2000)

Ideal Scenario

# First graph - the set up
hurricanes_1800s_1900s$colors <- ifelse(hurricanes_1800s_1900s$year < 2000, "highlight", "gray")

hurricanes_1800s_1900s %>% 
  ggplot( aes(x=year, y=total_hurricanes_unadjusted_smoothed, color = colors)) +
  geom_line() +
  scale_color_manual(values = c("highlight" = "indianred", "gray" = "gray")) +
  labs(
    title = "Number of Hurricanes in the North Atlantic, 1878–2022",
    subtitle = "1878–2000 showed variation without a major trend.",
    caption = "Data from NOAA",
    y = "Number of North Atlantic Hurricanes",
    x = "Year"
    ) +
  scale_y_continuous(
    limits = c(2.5, 11)
  ) +
  theme(legend.position = "none")

Introduce the Issue

# Second graph - the issue

hurricanes_1800s_1900s %>% 
  ggplot( aes(x=year, y=total_hurricanes_unadjusted_smoothed, color = colors)) +
  geom_line() +
  scale_color_manual(values = c("highlight" = "gray", "gray" = "red")) +
  labs(
    title = "Number of Hurricanes in the North Atlantic, 1878–2020",
    subtitle = "1878–2000 showed variation without a major trend.",
    caption = "Data from NOAA",
    y = "Number of North Atlantic Hurricanes",
    x = "Year"
    ) +
  scale_y_continuous(
    limits = c(2.5, 11)
  ) +
  annotate(geom="text", x=1990, y=10,
             label="2018 and 2019 showed the highest amount\nof North Atlantic hurricanes yet.") +
  annotate(geom="point", x=2018, y=9, size=10, shape=21, fill="transparent") +
  theme(legend.position = "none")

Hurricane/Typhoons and Tornadoes Frequency and Cyclone Intensity

storms_events_25_yrs_tornadoes_summarise_v3 <- storms_events_25_yrs_tornadoes_summarise_v2 |>
  filter(YEAR < 2025) |>
  filter(YEAR != 2006)

torn_hurr_typh <- cbind(storms_events_25_yrs_tornadoes_summarise_v3, storms_events_25_yrs_hurricane_typhoons_summarise_v2)

torn_hurr_typh <- torn_hurr_typh[,c(-3)]

colnames(torn_hurr_typh) <- c("year", "tornado_count", "hurricane_typhoon_count")

torn_hurr_typh_long <- torn_hurr_typh %>%
  pivot_longer(
    cols = c(tornado_count, hurricane_typhoon_count), # Columns to reshape
    names_to = "type",                     # New column for variable names
    values_to = "count"                    # New column for values
  )
# Hurricane + Typhoons graph

p1 <- torn_hurr_typh_long %>% 
  ggplot( aes(x=year, y=count, color=type)) +
    geom_line() +
    geom_point(
    # fill = "indianred", 
    size = 2, 
    pch = 21, # Type of point that allows us to have both color (border) and fill.
    # color = "white", 
    stroke = 1 # The width of the border, i.e. stroke.
    ) +
  labs(
    title = "Hurricane/Typhoon and Tornado Count",
    subtitle = "A hurricane is a tropical cyclone with maximum sustained winds of 74 mph (64 knots) or higher.\nIn the western North Pacific, hurricanes are called typhoons; similar storms in the Indian Ocean\nand South Pacific Ocean are called cyclones.",
    caption = "Data from NWS",
    y = "Count",
    x = "Year"
  ) +
  scale_color_manual(values = c("seagreen", "saddlebrown")) +
  guides(fill = "none") +
  annotate(geom="text", x=2012, y=995,
             label="2003 - 2006 had a sharp increase in both\nhurricanes (typhoons) and tornadoes. Both\nshow an upward trend over the recent years.") +
  annotate(geom="point", x=2004, y=995, size=10, shape=21, fill="transparent") +
  scale_color_discrete(
    labels = c("Hurricane/Typhoon", "Tornado"),
    name = "Type")
## Scale for colour is already present.
## Adding another scale for colour, which will replace the existing scale.
p2 <- power_dissipation_index_v1 %>% 
  ggplot( aes(x=year, y=smoothed_pdi)) +
    geom_line(color="red4", size = 1) +
    geom_point(
    color = "red4", 
    size = 2, 
    pch = 21, # Type of point that allows us to have both color (border) and fill.
    color = "white", 
    stroke = 1 # The width of the border, i.e. stroke.
  ) +
  # geom_segment(aes(x = 2002, y = 0.3, xend = 2024, yend = 0.8),
  #   arrow = arrow(length = unit(0.5, "cm"), type = "closed"),
  #   color = "white",
  #   size = 1.5,
  #   linetype = "solid"
  # ) +
  labs(
    title = "North Atlantic Tropical Cyclone Activity According to the Power\nDissipation Index",
    subtitle = "Annual values of the Power Dissipation Index (PDI), which accounts for\ncyclone strength, duration, and frequency.",
    y = "Power Dissipation Index (PDI)",
    x = "Year",
    caption = "Data from National Oceanic and Atmospheric Administration and Kerry Emanuel at the Massachusetts Institute of Technology."
  ) +
  annotate(geom="text", x=2012, y=5.5545,
             label="2003 - 2006 had a massive increase in storm intensity.") +
  annotate(geom="point", x=2004, y=5.5545, size=10, shape=21, fill="transparent") +
  theme(legend.position = "None")


p1 | p2

Earth’s Temperature

# Earth's temperature graph
library(grid)
library(ggnewscale)
library(ggtext)
library(tidyverse)
library(shadowtext)
library(patchwork)

earth_temp_v2 <- earth_temp_v1

earth_temp_v2$text <- "Annual average temperatures worldwide\n have risen since 2000."

earth_temp_v1 %>% 
  ggplot( aes(x=year, y=anomaly_mean)) +
    geom_line(color=lighten("darkred", 0.2), size = 2) +
    geom_point(
    fill = lighten("darkred", 0.2), 
    size = 2, 
    pch = 21, # Type of point that allows us to have both color (border) and fill.
    color = "white", 
    stroke = 1 # The width of the border, i.e. stroke.
  ) +
  geom_area(aes(year, anomaly_mean), fill = lighten("darkred", 0.2)) +
  geom_segment(aes(x = 2002, y = 0.3, xend = 2024, yend = 0.8),
    arrow = arrow(length = unit(0.5, "cm"), type = "closed"),
    color = "white",
    size = 1.5,
    linetype = "solid"
  ) +
  labs(
    title = "Global Land and Ocean Average Temperature Anomalies",
    subtitle = "The difference between the observed temperature and the 1901-2000 average global temperature.",
    y = "Temperature Anomaly (°F)",
    x = "Year"
  ) +
  annotate("label", x = 2018, y = 0.3, label = "Annual average temperatures worldwide\n have steadily risen since 2000.", size = 3.5, fill =
             "white", color = "black", label.size = 1, label.color="white") +
  theme(legend.position = "None")

  # geom_textbox(width = unit(0.4, "npc"), data = "test") +
  # theme_minimal() 

Conclusion

# final graph set up
earth_temp_2020 <- earth_temp_v1 |>
  filter(year <= 2020)

storms_events_25_yrs_summarise_2020 <- storms_events_25_yrs_summarise_v2 |>
  filter(year <= 2020)

merged_df <- cbind(power_dissipation_index_v1, earth_temp_2020, storms_events_25_yrs_summarise_2020)

merged_df <- merged_df[,-c(3, 5)]
# Conclusion graph
gradient_fill <- linearGradient(
      col = c("pink", "darkred"),
      x1 = 0, y1 = 0, x2 = 1, y2 = 0 # Vertical gradient from bottom (0) to top (1)
    )

p1 <- ggplot(merged_df, aes(x=anomaly_mean, y=smoothed_pdi, label=year, fill=anomaly_mean)) + 
  geom_jitter(
    aes(size = total_hurricane_typhoons_tornadoes_count), 
    # size = total_hurricane_typhoons_tornadoes_count, 
    pch = 21, # Type of point that allows us to have both color (border) and fill.
    # color = "red",
    # fill = "red",
    stroke = 1 # The width of the border, i.e. stroke
    ) +
  # geom_smooth(method = "lm", se = FALSE, color = "red", linetype = "solid") +
  geom_segment(aes(x = 0.4125, y = 3.1, xend = 1.03, yend = 3.8),
    arrow = arrow(length = unit(0.5, "cm"), type = "closed"),
    color = "indianred4",
    size = 1,
    linetype = "dashed"
  ) +
  geom_text(
    # label=rownames(data), 
    nudge_x = 0.025, nudge_y = 0.025,
    check_overlap = T
  ) +
  scale_x_continuous(
    # name = "Annual Mean Wage (in US Dollars)",
    limits = c(0.4, 1.1)
  ) +
  # guides(fill = "none") +
  scale_size_continuous(name = "Total Hurricanes,\nTyphoons\nand Tornadoes") +
  scale_fill_continuous(name = "Temperature\nAnomaly (°F)") +
  annotate("label", x = 0.95, y = 3.1, label = "As earth's temperature rises over the years,\ncyclone intensity increases as well.", size = 3.5, fill =
             "white", color = "black", label.size = 1, label.color="white") +
  labs(
    title = "Power Dissipation Index (PDI) vs Temperature Anomaly (°F)",
    subtitle = "Annual values of the Power Dissipation Index (PDI), which accounts\nfor cyclone strength, duration, and frequency. Temperature anomaly is the difference\nbetween the observed temperature and the 1901-2000 average global temperature.",
    y = "Power Dissipation Index (PDI)",
    x = "Temperature Anomaly (°F)"
  ) +
    scale_fill_gradient(low = "red", high = "darkred", name="Temperature\nAnomaly (°F)") + # Simple gradient from red to darkred
    theme(legend.position = "bottom")
## Warning in annotate("label", x = 0.95, y = 3.1, label = "As earth's temperature
## rises over the years,\ncyclone intensity increases as well.", : Ignoring
## unknown parameters: `label.size` and `label.colour`
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
p1