Stacked area chart of Ni elections.
Code from https://bl.ocks.org/mbostock/3885211
Data from https://www.reddit.com/r/ireland/comments/5xgt8r/share_of_unionist_seats_in_ni/
poverty <-read.csv("cleanpovertyMin.csv", header = TRUE, sep = ",", quote = "\"",dec = ".", fill = TRUE, comment.char = "") | |
> head(poverty) | |
i <- sapply(poverty, is.factor) | |
poverty[i] <- lapply(poverty[i], as.character) | |
sapply(unique(poverty$year), function(year) { | |
png(file=sprintf("tmp/household%d.png", year), | |
type="quartz", antialias="subpixel", width=800, height=600) |
Stacked area chart of Ni elections.
Code from https://bl.ocks.org/mbostock/3885211
Data from https://www.reddit.com/r/ireland/comments/5xgt8r/share_of_unionist_seats_in_ni/
House prices in Real terms since 1975 in various countries
example code used from https://bl.ocks.org/mbostock/3884955 Data from International House Price Database https://www.dallasfed.org/institute/houseprice/#tab1 using 'the house price index expressed in real terms (RHPI)'
"Each country’s house price index is seasonally adjusted over the entire sample period with an unobserved components time series model and then rebased to 2005 = 100"
read_csv('GEOSTAT_grid_POP_1K_2011_V2_0_1.csv') %>% | |
rbind(read_csv('JRC-GHSL_AIT-grid-POP_1K_2011.csv') %>% | |
mutate(TOT_P_CON_DT='')) %>% | |
mutate(lat = as.numeric(gsub('.*N([0-9]+)[EW].*', '\\1', GRD_ID))/100, | |
lng = as.numeric(gsub('.*[EW]([0-9]+)', '\\1', GRD_ID)) * ifelse(gsub('.*([EW]).*', '\\1', GRD_ID) == 'W', -1, 1) / 100) %>% | |
filter(lng > 28, lng < 34) %>% | |
filter(lat > 28, lat < 34) %>% | |
group_by(lng=round(lng, 1), lat=round(lat, 1)) %>% | |
summarize(value = sum(TOT_P, na.rm=TRUE)) %>% | |
ungroup() %>% |
read_csv('GEOSTAT_grid_POP_1K_2011_V2_0_1.csv') %>% | |
rbind(read_csv('JRC-GHSL_AIT-grid-POP_1K_2011.csv') %>% | |
mutate(TOT_P_CON_DT='')) %>% | |
mutate(lat = as.numeric(gsub('.*N([0-9]+)[EW].*', '\\1', GRD_ID))/100, | |
lng = as.numeric(gsub('.*[EW]([0-9]+)', '\\1', GRD_ID)) * ifelse(gsub('.*([EW]).*', '\\1', GRD_ID) == 'W', -1, 1) / 100) %>% | |
filter(lng > 28, lng < 34) %>% | |
filter(lat > 28, lat < 34) %>% | |
group_by(lng=round(lng, 1), lat=round(lat, 1)) %>% | |
summarize(value = sum(TOT_P, na.rm=TRUE)) %>% | |
ungroup() %>% |
read_csv('GEOSTAT_grid_POP_1K_2011_V2_0_1.csv') %>% | |
rbind(read_csv('JRC-GHSL_AIT-grid-POP_1K_2011.csv') %>% | |
mutate(TOT_P_CON_DT='')) %>% | |
mutate(lat = as.numeric(gsub('.*N([0-9]+)[EW].*', '\\1', GRD_ID))/100, | |
lng = as.numeric(gsub('.*[EW]([0-9]+)', '\\1', GRD_ID)) * ifelse(gsub('.*([EW]).*', '\\1', GRD_ID) == 'W', -1, 1) / 100) %>% | |
filter(lng > 28, lng < 34) %>% | |
filter(lat > 28, lat < 34) %>% | |
group_by(lng=round(lng, 1), lat=round(lat, 1)) %>% | |
summarize(value = sum(TOT_P, na.rm=TRUE)) %>% | |
ungroup() %>% |
Attempt at a chord diagram of language translation
#This is inspired by this spiral animation of the same dataset | |
#http://www.climate-lab-book.ac.uk/2016/spiralling-global-temperatures/ | |
#and this R code to produce the animation | |
#https://gist.github.com/jebyrnes/b34930da0052a86f5ffe254ce9900357 | |
# It also uses elements of this http://www.r-bloggers.com/making-faceted-heatmaps-with-ggplot2/ | |
# and this https://rpubs.com/bradleyboehmke/weather_graphic graphic | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) |
#Minor change to the code at https://robwhickman.github.io/2017/05/18/where-europeans-live/ to make an animation instead of a grid | |
saveGIF({ | |
for (percent in seq(05,95,5)){ | |
percentage <- percent | |
sortingDF <- level3@data %>% select(NUTS_ID, pop2014, Density) | |
totalpop <- sum(sortingDF$pop2014, na.rm = TRUE) | |
#sort by density (i.e. find smallest area for max pop) |
This project can be used to generate Voronoi maps using D3 and Leaflet. This code was made by Chris Zeeter and the data comes from https://data.gov.ie/dataset/dublinbikes. See an explanation of the code.
The code is released under the The MIT License.