library(arrow)
library(dplyr)
library(lubridate)
library(timetk)
library(ggplot2)
library(directlabels)
library(viridis)
library(ggdark)
According to the last Copernicus report, 2023 was exceptional hot year. The image bellow from this report circulated a lot at the social media.
Clearly, 2023 temperatures are the highest in comparison to other years and the temperature difference to the previous years is unmatched.
It is important to comprehend that this graph used data from all the globe surface, including the oceans, giving us an overall picture. At some places this temperature anomaly may be different, with weaker or even stronger differences.
But how are 2023 temperatures at the local level, where I live?
To answer this question, first we need to have specific data by location. One way to produce this specific data is with zonal statistics.
Zonal statistics is a operation where statistics are computed for a set of cell values that intersects a given spatial boundary.
I created a dataset with zonal statistics for the Brazilian municipalities, with data from 1950 to 2022 using data from the ERA5-Land reanalysis.
Thus, to make similar graphs to Brazilian municipalities, I used the same methodology with the available 2023 ERA5-Land data (from January to October).
The data is ready, let’s make some plots! First, load the necessary packages.
Now, we will read the data from the 1950-2022 period. This parquet file is available to download at Zenodo with daily data to all Brazilian municipalities, from 1950 to 2022.
1<- open_dataset(sources = "../../brclim2/output_data/parquet/2m_temperature_mean.parquet") %>%
temp 2filter(name == "2m_temperature_mean_mean") %>%
3filter(date >= as.Date("1990-01-01")) %>%
4collect() %>%
mutate(
5year = year(date),
6date = update(date, year = 2023),
7value = value - 273.15
)
- 1
- Open the parquet dataset without loading it all to the memory.
- 2
- Filter the desired indicator, on this case, the average temperature.
- 3
- Keep the data only after 1990 to produce a cleaner graph.
- 4
- Collect the data from the parquet file to memory.
- 5
- Create a new variable with the year.
- 6
- Change the year of all dates to 2023. This will make easer to overlay the time series of each year.
- 7
- The original values are in Kelvin. Let’s convert it to Celsius Degrees.
And now load the 2023 data. I will share this parquet file later…
<- open_dataset(sources = "../../brclim2/output_data/data_2023/parquet/2m_temperature_mean.parquet") %>%
temp_23 filter(name == "2m_temperature_mean_mean") %>%
collect() %>%
mutate(value = value - 273.15)
To make a graph, we can set a municipality code for reference (e.g. Rio de Janeiro, RJ) and create a list object with all the necessary data. Then, we create a simple and nice ggplot ;-)
Code
<- 3304557
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Rio de Janeiro, RJ",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
I choose to use a LOESS smooth because the original daily data is very noise, making harder to see the general trends.
Following the global trend, the temperature at Rio Janeiro, RJ at 2023 has been exceptional hot after September.
Bellow, the same plot for the Brazilian capitals and some selected municipalities. You will see that at some municipalities the 2023 temperatures are higher than other years, but at some others places the values are lower. This is the climate change effect, leading climate indicators to different extremes, increasing its variabilities.
Porto Velho, RO
Code
<- 1100205
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Porto Velho, RO",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Manaus, AM
Code
<- 1302603
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Manaus, AM",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Rio Branco, AC
Code
<- 1200401
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Rio Branco, AC",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Campo Grande, MS
Code
<- 5002704
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Campo Grande, MS",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Macapá, AP
Code
<- 1600303
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Macapá, AP",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Brasília, DF
Code
<- 5300108
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Brasília, DF",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Boa Vista, RR
Code
<- 1400100
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Boa Vista, RR",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Cuiabá, MT
Code
<- 5103403
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Cuiabá, MT",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Palmas, TO
Code
<- 1721000
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Palmas, TO",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
São Paulo, SP
Code
<- 3550308
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "São Paulo, SP",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Teresina, PI
Code
<- 2211001
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Teresina, PI",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Rio de Janeiro, RJ
Code
<- 3304557
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Rio de Janeiro, RJ",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Belém, PA
Code
<- 1501402
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Belém, PA",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Goiânia, GO
Code
<- 5208707
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Goiânia, GO",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Salvador, BA
Code
<- 2927408
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Salvador, BA",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Florianópolis, SC
Code
<- 4205407
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Florianópolis, SC",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
São Luiz, MA
Code
<- 2111300
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "São Luiz, MA",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Maceió, AL
Code
<- 2704302
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Maceió, AL",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Porto Alegre, RS
Code
<- 4314902
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Porto Alegre, RS",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Curitiba, PR
Code
<- 4106902
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Curitiba, PR",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Belo Horizonte, MG
Code
<- 3106200
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Belo Horizonte, MG",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Fortaleza, CE
Code
<- 2304400
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Fortaleza, CE",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Recife, PE
Code
<- 2611606
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Recife, PE",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
João Pessoa, PB
Code
<- 2507507
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "João Pessoa, PB",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Aracaju, SE
Code
<- 2800308
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Aracaju, SE",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Natal, RN
Code
<- 2408102
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Natal, RN",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Vitória, ES
Code
<- 3205309
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Vitória, ES",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Nova Friburgo, RJ
Code
<- 3303401
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Nova Friburgo, RJ",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)
Juiz de Fora, MG
Code
<- 3136702
code_ref
<- list(
temp_list temp = temp %>% filter(code_muni == code_ref),
temp_23 = temp_23 %>% filter(code_muni == code_ref)
)
ggplot() +
geom_line(
data = temp_list$temp,
aes(x = date, y = value, color = year, group = year),
alpha = .3,
stat = "smooth",
method = "loess"
+
) scale_color_viridis(option = "plasma") +
geom_line(
data = temp_list$temp_23,
aes(x = date, y = value),
color = "red",
lwd = 1, alpha = .7,
stat = "smooth",
method = "loess"
+
) geom_dl(
data = temp_list$temp_23,
aes(x = date, y = value, label = "2023"),
method = list(dl.combine("last.points")),
color = "red",
cex = 0.8
+
) ylim(15, 35) +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
dark_theme_gray() +
theme(
legend.position = "bottom",
legend.direction = "horizontal"
+
) labs(
title = "Juiz de Fora, MG",
x = "Date",
y = "Average temperature (°C)",
color = NULL
)