Graph 1

In the following graph I am attempting to determine whether each region is seeing an increase or decrease in average temperature from 2000 to 2024. The choice of a scatter plot will enable me to see whether temperatures are trending higher of lower over time.

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
climate_df <- read.csv("C:/Temp/Fa25_FinalProject_climate_data_normalized_Craig_Johnson.csv", header=TRUE)

max_temps_by_region <- climate_df %>%
   group_by(region, year) %>%
   summarise(max_avg_temp = max(avg_temp_celsius, na.rm = TRUE))
## `summarise()` has grouped output by 'region'. You can override using the
## `.groups` argument.
df_africa <- max_temps_by_region[max_temps_by_region$region == "Africa", ]
df_asia <- max_temps_by_region[max_temps_by_region$region == "Asia", ]
df_europe <- max_temps_by_region[max_temps_by_region$region == "Europe", ]
df_na <- max_temps_by_region[max_temps_by_region$region == "North America", ]
df_oceania <- max_temps_by_region[max_temps_by_region$region == "Oceania", ]
df_sa <- max_temps_by_region[max_temps_by_region$region == "South America", ]

par(mar = c(5, 4, 4, 9), xpd = TRUE)

plot(df_africa$year,
     df_africa$max_avg_temp,
     type="b",
     xlab = "Year",
     ylab = "Max Avg. Temp (Celsius)",
     main = "Max Average Temp per Region and Year",
     col="blue4",
     xlim = c(2000,2025),
     ylim = c(10,30))

lines(df_asia$year,
      df_asia$max_avg_temp,
      col = "red4",
      type="b")

lines(df_europe$year,
      df_europe$max_avg_temp,
      col = "darkgoldenrod2",
      type="b")

lines(df_na$year,
      df_na$max_avg_temp,
      col = "green4",
      type="b")

lines(df_oceania$year,
      df_oceania$max_avg_temp,
      col = "darkorange4",
      type="b")

lines(df_sa$year,
      df_sa$max_avg_temp,
      col = "grey4",
      type="b")

text(x = df_africa$year,
     y = df_africa$max_avg_temp,
     labels = df_africa$max_avg_temp,
     pos = 3, cex = 0.8)

text(x = df_asia$year,
     y = df_asia$max_avg_temp,
     labels = df_asia$max_avg_temp,
     pos = 3, cex = 0.8)

text(x = df_europe$year,
     y = df_europe$max_avg_temp,
     labels = df_europe$max_avg_temp,
     pos = 3, cex = 0.8)

text(x = df_na$year,
     y = df_na$max_avg_temp,
     labels = df_na$max_avg_temp,
     pos = 3, cex = 0.8)

text(x = df_oceania$year,
     y = df_oceania$max_avg_temp,
     labels = df_oceania$max_avg_temp,
     pos = 3, cex = 0.8)

text(x = df_sa$year,
     y = df_sa$max_avg_temp,
     labels = df_sa$max_avg_temp,
     pos = 3, cex = 0.8)

legend("topright", legend = c("Africa", "Asia", "Europe", "North America", "Oceania", "South America"), 
col = c("blue4","red4","darkgoldenrod2","green4","darkorange4","grey4"), 
lty = c(1,1,1,2),
inset = c(-0.28, 0),
lwd = 2) 


Graph 1 Analysis:

As we look at the above scatter plot, it is easy to see that temperatures for all regions have increased from 2000 to 2024. Additionally, each of the regions appear to have a steady increase for each 5 year increment. Lastly, we can see that the region of Africa has the highest average temperatures, while the region of North America has the lowest.

Graph 2

In the following graph, I attempting to determine whether specific countries are seeing a sea level rise as their temperatures increase.The choice of a faceted scatter plot enables me to easily visualize the comparison of Avg. Temp and Sea Level Rise (MM) for each country.

library(ggplot2)
library(trelliscopejs)
## This package is no longer maintained. Please use the 'trelliscope' package instead (see https://github.com/trelliscope/).
climate_df <- read.csv("C:/Temp/Fa25_FinalProject_climate_data_normalized_Craig_Johnson.csv", header=TRUE)

output_dir <- "."

ggplot(climate_df,
       aes(x=year,
           y=avg_temp_celsius,
           size = avg_temp_celsius,
           color=sea_level_rise_mm,
           label = avg_temp_celsius)) +
  scale_color_gradient(low = "green2",
                       high = "red2") +
  geom_point() +
  geom_text(nudge_y = 1,
            check_overlap = TRUE,
            size = 2.5) +
  labs(x = "Year",
       y = "Average Temperature (Celsius)",
       color = "Sea Level Rise (MM)",
       size = "Avg. Temp (C)") +
  theme(legend.text = element_text(size = 10), 
    legend.key.size = unit(0.6, "cm")) +
  facet_trelliscope(~ country,
                    nrow = 1,
                    name = "Sea Level Rise & Temperature Increase by Country",
                    ncol = 2,
                    self_contained = TRUE,
                    path = output_dir)
## using data from the first layer

Graph 2 Analysis:

To interpret the scatter plots, I have made the size of the dots larger as the Avg. Temp (C) increases and set the color to start at green and progress to red as Sea Level Rise (MM) increases. As we look at the graph for Australia, we can see clearly that as the temperature increases from 2000 to 2024 so does the sea level rise. Additionally, as we look through the different graphs, we can see that this is a pretty steady trend for almost all countries. Lastly, if we want to filter by Region, we can see that for North America, the United States has the highest Avg Temp (C) and Sea Level Rise (MM).

Graph 3

In the following graph, I am attempting to see if there is any correlation between the forest area of a country and the extreme weather events which impact the country over a time span of 2000 to 2024. I selected a Plotly scatter plot to easily show the forest area and extreme weather values, while enabling the individual plots to be viewed through animation.

library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(gapminder)

climate_df <- read.csv("C:/Temp/Fa25_FinalProject_climate_data_normalized_Craig_Johnson.csv", header=TRUE)

climate_df %>%
  plot_ly(x = ~year,
          y = ~forest_area_pct,
          hoverinfo = 'text',
          text = ~paste("Extreme Weather: ", extreme_weather_events, "<br>",
                        "Forest Area: ", forest_area_pct),
          mode = "markers",
          type = "scatter",
          frame = ~country,
          marker = list(size = ~forest_area_pct,
                        color = ~extreme_weather_events,
                        colors = c("green", "red"),
                        showscale = TRUE,
                        sizemode = "diameter")) %>%
  layout(xaxis=list(title="Year"),
         yaxis=list(title="Forest Area"),
         title="Extreme Weather vs. Forest Area") %>%
  animation_opts(frame = 3000, transition = 2000, redraw = FALSE)  %>%
  animation_slider(currentvalue = list(font = list(color="black"),
                                       prefix = "Country: "))

Graph 3 Analysis:

To interpret the above scatter plot, the size of the points grow smaller as the forest size decreases and the color moves to a darker red as the number of extreme weather events grow. Looking at Australia, we can see that the severe weather events have gone from 8 in 2020 to 16 in 2024, while the forest area actually increased by 1.35%. Looking at Italy, we can see that the severe weather events have gone from 7 in 2020 to 20 in 2024, while the forest area actually increased by 2.7%. Based on these findings, it does not appear that there is a correlation between severe weather events and forest area.