library(data.table)
library(ggplot2)
library(metR)
out.file <- "~/Downloads/erebus_atm_2001_dem_v5.tif"
if (!file.exists(out.file)) {
# data => https://www.pgc.umn.edu/data/elevation/
# ~ 90Mb
download.file("http://data.pgc.umn.edu/elev/dem/atm/2001/erebus_atm_2001_dem_v5.tif",
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
Positron Version: 2025.03.0 (system setup) build 116 | |
Code - OSS Version: 1.96.0 | |
Commit: 7f0f93873e8b24c9f393bb3586724f4783c5e72c | |
Date: 2025-03-01T18:59:57.025Z | |
Electron: 32.2.6 | |
Chromium: 128.0.6613.186 | |
Node.js: 20.18.1 | |
V8: 12.8.374.38-electron.0 | |
OS: Windows_NT x64 10.0.26100 |
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(raster) | |
library(rayshader) | |
#Load QGIS georeference image (see https://www.qgistutorials.com/en/docs/3/georeferencing_basics.html) | |
testindia = raster::stack("1870_southern-india_modified.tif") | |
#Set bounding box for final map (cut off edges without data, introduced via reprojection) | |
india_bb = raster::extent(c(68,92,1,20)) | |
cropped_india = raster::crop(testindia, india_bb) | |
#Convert to RGB array |
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
pacman::p_load(tidyverse, scales, glue, extrafont, rvest, ggtextures, cowplot, polite) | |
# Roboto Condensed font (from hrbrmstrthemes or just Google it) | |
loadfonts() | |
# web scrape | |
topg_url <- "https://en.wikipedia.org/wiki/AFC_Asian_Cup_records_and_statistics" | |
session <- bow(topg_url) | |
ac_top_scorers <- scrape(session) %>% |
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(sf) | |
library(tigris) | |
# start by picking a state from https://github.com/Microsoft/USBuildingFootprints | |
# WARNING: these files can be pretty big. using arizona for its copious subdivisions and reasoanable 83MB. | |
url_footprint <- "https://usbuildingdata.blob.core.windows.net/usbuildings-v1-1/Arizona.zip" | |
download.file(url_footprint, "Arizona.zip") | |
unzip("Arizona.zip") |
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(raster) | |
library(cartography) | |
library(sf) | |
library(SpatialPosition) | |
mtq <- st_read(system.file("shape/martinique.shp", package="cartography")) | |
# use WGS84 proj | |
mtq_latlon <- st_transform(mtq, 4326) | |
# this call throw an error but seems to work... | |
getData('SRTM', lon=-61, lat=14) |
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(sf) | |
library(spatstat) | |
library(sp) | |
library(maptools) | |
library(raster) | |
library(cartography) | |
library(SpatialPosition) | |
## import dataset | |
feat <- sf::st_read("https://gist.githubusercontent.com/rCarto/747164575e3f216a123c3092d0ce9162/raw/f12390464f255b5f9760c577ab6bf5456cf61a40/iris75.geojson") |
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(sf) | |
library(ggplot2) | |
library(gganimate) | |
# Data from personal correspondance | |
# Collapse all dates to the same year | |
d$year <- format(d$date, '%Y') | |
d$stand_time <- as.POSIXct(paste0('2000-', format(d$date, '%m-%d %T'))) |
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
import seaborn as sns | |
import numpy as np | |
import matplotlib.pyplot as plt | |
iris = sns.load_dataset('iris') | |
f, ax = plt.subplots(figsize=(10, 8)) | |
species_list = np.unique(iris.species) | |
color_list = ['r', 'g', 'b'] | |
data = [np.array(iris[iris.species==s].sepal_length) for s in species_list] |
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(tidycensus) | |
library(tmap) | |
library(tmaptools) | |
library(sf) | |
library(tigris) | |
library(magick) | |
library(tidyverse) | |
options(tigris_use_cache = TRUE) | |
ctys <- c("Dallas", "Tarrant", "Collin County", "Denton", |
NewerOlder