Skip to content

Instantly share code, notes, and snippets.

View Pakillo's full-sized avatar
🌳
Living the dream

Francisco Rodriguez-Sanchez Pakillo

🌳
Living the dream
View GitHub Profile
@Pakillo
Pakillo / diverge0.R
Created December 12, 2019 13:44 — forked from johnbaums/diverge0.R
Plot a rasterVis::levelplot with a colour ramp diverging around zero
diverge0 <- function(p, ramp) {
# p: a trellis object resulting from rasterVis::levelplot
# ramp: the name of an RColorBrewer palette (as character), a character
# vector of colour names to interpolate, or a colorRampPalette.
require(RColorBrewer)
require(rasterVis)
if(length(ramp)==1 && is.character(ramp) && ramp %in%
row.names(brewer.pal.info)) {
ramp <- suppressWarnings(colorRampPalette(brewer.pal(11, ramp)))
} else if(length(ramp) > 1 && is.character(ramp) && all(ramp %in% colors())) {
@Pakillo
Pakillo / Sentinel2-repaso.R
Created October 23, 2019 07:04
Sentinel-2 repaso
## Working with Sentinel-2 bands in R
# Crear proyecto de RStudio
## Cargar paquetes necesarios
library(raster)
@Pakillo
Pakillo / Sentinel2-intro.R
Created October 23, 2019 07:04
Sentinel2-intro.R
## Working with Sentinel-2 bands in R
## Primeros pasos
# - Crear proyecto de RStudio
#
# - Guardar capas (ZIP) en la misma carpeta
### Title: Back to basics: High quality plots using base R graphics
### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015
###
### Date created: 20150418
### Last updated: 20150423
###
### Author: Michael Koontz
### Email: mikoontz@gmail.com
### Twitter: @michaeljkoontz
###
@Pakillo
Pakillo / themes.R
Last active September 6, 2018 05:00
ggplot_themes
### My favourite ggplot2 themes, always accessible ###
## just source this gist from any project ##
#####################################################################################
# Noam's default ggplot2 styling #####
# Source: https://github.com/noamross/noamtools/blob/master/R/theme_nr.R
theme_nr <-theme(text=element_text(family="Helvetica", size=14),
panel.grid.major.x=element_blank(),
@Pakillo
Pakillo / cc_paleotemp.R
Created September 3, 2018 18:25
Figure of Cenozoic (last 66 million years) and future global temperatures expected with climate change
library(ggplot2)
library(cowplot)
library(latex2exp)
#### PALEOTEMPERATURES ####
## Data from Hansen: http://www.columbia.edu/~jeh1/mailings/2012/20120508_ClimateSensitivity.pdf
## Available here: http://www.columbia.edu/~mhs119/Sensitivity+SL+CO2/Table.txt
@Pakillo
Pakillo / repromap.R
Last active March 21, 2018 19:01
another reproducible map with Rstats
library(sf)
library(ggspatial)
library(ggthemes)
coast <- rnaturalearth::ne_coastline(scale = "small", returnclass = "sp")
forests <- st_read("data/forestmap/cfc_gen.shp")
forest.redux <- rmapshaper::ms_simplify(forests)
forest.redux.sp <- as(forest.redux, "Spatial")
@Pakillo
Pakillo / coauthor-networks.R
Created February 17, 2015 00:22
Coauthorsip networks
# Author network mapping for journal publications.
# By: Simon Goring (final code: 10/2/2013)
# https://downwithtime.wordpress.com/2013/02/10/on-blogging-and-collaboration/
library(bibtex)
library(network)
library(RColorBrewer)
# Read in the bibtex file
# You can export this file from your google scholar network.
@Pakillo
Pakillo / Worldclim_Precipitation_Uncertainty.md
Last active May 16, 2017 12:31
Uncertainty in global climate databases: comparing Worldclim with Iberian climate atlas

Precipitation: Worldclim vs Iberian Climatic Atlas

Francisco Rodriguez-Sanchez 2017-05-16

library(knitr)
opts_chunk$set(cache = TRUE, message = FALSE)
library(raster)