Last active
April 29, 2020 10:24
-
-
Save mschnetzer/1b77fc9b81d3cd8fd4c12c6a3b0c800d to your computer and use it in GitHub Desktop.
Durchschnittliche Lufttemperatur in Wien 1775-2017 (https://twitter.com/matschnetzer/status/1029246243741032448)
This file contains 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(tidyverse) | |
library(msthemes) # https://github.com/mschnetzer/msthemes | |
# Get data from http://www.zamg.ac.at/histalp/dataset/station/csv.php | |
data <- read_csv2("HISTALP_AT_WIE_T01_1760_2025.csv", skip = 13) | |
data <- data %>% mutate_at(vars("jan-dec"), list(temp = ~ .*0.1)) %>% | |
select(year, temp) %>% filter(year %in% c(1775:2019)) %>% | |
mutate(abw = log(temp/mean(temp))) | |
data$draw <- 1 | |
tempalette <- c("#3e9cd3","#08306b","#2171b5","#9ecae1","#fee0d2","#ef3b2c","#67000d") | |
data %>% ggplot(aes(x=year,y=draw,fill=abw)) + | |
geom_bar(stat="identity",width=1) + | |
scale_fill_gradientn(colours = tempalette, limits = c(min(data$abw), max(data$abw))) + | |
theme_ms() + | |
theme(axis.title.y = element_blank(), | |
axis.text.y = element_blank(), | |
legend.position = "none", | |
panel.grid.major.y = element_blank()) + | |
labs(x = "", y = "", | |
title = "Klimawandel in Wien, 1775-2019", | |
subtitle = "Durchschnittliche Lufttemperatur gemessen auf der Hohen Warte", | |
caption = "Daten: Histalp, ZAMG. Grafik: @matschnetzer") + | |
ggsave("warmingstripes_vie.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment