Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Pakillo
Created January 11, 2021 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pakillo/25d00e6901fcea39d13145e45034f6ec to your computer and use it in GitHub Desktop.
Save Pakillo/25d00e6901fcea39d13145e45034f6ec to your computer and use it in GitHub Desktop.
Tiempo vs Clima - Weather vs Climate
library(ggplot2)
t <- 1:100 # create time sequence
# warming trend, constant variance
clima <- data.frame(t = t,
temp = rnorm(100, 15 + 0.03*t, sd = 1))
# warming trend + increasing variance
clima <- data.frame(t = t,
temp = rnorm(100, 15 + 0.03*t, sd = 1 + 0.03*t))
# Plot
ggplot(clima) +
geom_line(aes(t, temp)) +
theme_minimal(base_size = 18) +
geom_smooth(method = "lm", aes(t, temp), se = FALSE, colour = "red", size = 2) +
labs(x = "", y = "Temperatura",
title = "Diferencia entre tiempo y clima",
subtitle = "Aunque exista una clara tendencia al aumento de temperaturas,\npueden darse episodios fríos",
caption = "@frod_san") +
theme(axis.text.x = element_blank(),
plot.subtitle = element_text(colour = "grey20", size = 13),
plot.caption = element_text(size = 10, colour = "grey20"),
axis.title.y = element_text(size = 16, colour = "grey40"),
axis.text.y = element_text(size = 11, colour = "grey40"))
ggsave("tiempo_vs_clima.pdf")
@Pakillo
Copy link
Author

Pakillo commented Jan 11, 2021

tiempo_vs_clima_annotated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment