Created
June 1, 2019 14:39
-
-
Save gonzalezgouveia/238133dbda9702615448356974ddbda2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(maps) | |
library(ggthemes) | |
library(tidyverse) | |
library(gganimate) | |
# Hecho por Rafa @GonzalezGouveia | |
# Con gusto para #DatosDeMiercoles, propuesto por @R4DS_es | |
# leyendo los datos | |
terremotos <- readr::read_csv("https://raw.githubusercontent.com/cienciadedatos/datos-de-miercoles/master/datos/2019/2019-05-29/terremotos.csv") | |
# filtrando para terremotos | |
terremotos <- terremotos %>% | |
filter(tipo == 'terremoto') | |
# cargando datos de mapas | |
world <- ggplot() + | |
borders("world", colour = "gray85", fill = "gray70") + | |
theme_map() | |
# density map | |
world + | |
stat_density_2d(aes(x = longitud, | |
y = latitud, | |
fill = ..level..), | |
data = terremotos, | |
geom = "polygon", | |
alpha = 0.4, | |
h = 20) + | |
scale_fill_viridis_c() + | |
labs(title = "Desidad de terremotos 1965-2016") + | |
theme(legend.position = "none", | |
panel.background = element_rect(fill = "grey50"), | |
panel.grid = element_line(colour = "grey42"), | |
panel.grid.major = element_line(size = rel(0.5)), | |
panel.grid.minor = element_line(size = rel(0.25)), | |
title = element_text(size = rel(2))) | |
# guardando imagen | |
ggsave("./images/datos_de_miercoles_terremotos.png") | |
# Hecho por Rafa @GonzalezGouveia | |
# Con gusto para #DatosDeMiercoles, propuesto por @R4DS_es |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment