The initial source comes from sdcuike/issueBlog#4
https://github.com/PacktPublishing free to download books code by Packet
https://github.com/EbookFoundation/free-programming-books Very immense
| # load libraries | |
| library(tidyverse) | |
| library(osmdata) | |
| library(sf) | |
| library(ggtext) | |
| library(exactextractr) | |
| library(fasterize) | |
| library(ggtext) | |
| library(tidygeocoder) | |
| library(glue) |
| library(tidycensus) | |
| library(tidyverse) | |
| options(tigris_use_cache = TRUE) | |
| state_names <- c(state.name, "District of Columbia") | |
| names(state_names) <- state_names | |
| tictoc::tic() | |
| age_maps <- map(state_names, ~{ | |
https://github.com/PacktPublishing free to download books code by Packet
https://github.com/EbookFoundation/free-programming-books Very immense
| # Download elevation tif from eg http://www.eea.europa.eu/data-and-maps/data/digital-elevation-model-of-europe | |
| # First, convert elevation tif to a space delimited xyz (lng lat elevation) file | |
| # $ gdal_translate -of XYZ elevation3x3.tif /tmp/file.xyz | |
| df <- read_delim('/tmp/file.xyz', delim=' ', col_names=FALSE) | |
| df %>% | |
| mutate(X3 = na_if(X3, 0)) %>% | |
| ggplot(aes(X1, -X2 + 20 * X3/max(X3, na.rm=TRUE), group=X2)) + | |
| geom_line(size=0.05) + |
| #' Uncomfortable data | |
| #' LA R Users Group | |
| #' 2020-09-22 | |
| #' Edward Visel | |
| #' Setup | |
| library(tidyverse) | |
| path <- '/tmp/nycflights13/flights.csv' |
| <html> | |
| <head> | |
| <title>Using deck.gl with Mapbox GL JS (Method 2)</title> | |
| <script src="https://d3js.org/d3.v5.min.js" type="text/javascript"></script> | |
| <script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script> | |
| <script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script> | |
| <link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" /> | |
| <style type="text/css"> | |
| body { |
| <html> | |
| <head> | |
| <title>Using deck.gl with Mapbox GL JS (Method 2)</title> | |
| <script src="https://d3js.org/d3.v5.min.js" type="text/javascript"></script> | |
| <script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script> | |
| <script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script> | |
| <link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" /> | |
| <style type="text/css"> | |
| body { |
| <html> | |
| <head> | |
| <title>deck.gl ScatterplotLayer Example</title> | |
| <script src="https://d3js.org/d3.v5.min.js" type="text/javascript"></script> | |
| <script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script> | |
| <script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script> | |
| <link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" /> | |
| <style type="text/css"> | |
| body { |
| library(geofacet) | |
| library(ggplot2) | |
| # original plot | |
| ggplot(election, aes(candidate, votes / 1000000, fill = candidate)) + | |
| geom_col() + | |
| scale_fill_manual(values = c("#4e79a7", "#e15759", "#59a14f")) + | |
| facet_geo(~ state, grid = "us_state_grid2") + | |
| coord_flip() + | |
| ylab("Votes (millions)") |