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
/* rs-theme-name: Idle Eyes */ | |
/* rs-theme-is-dark: TRUE */ | |
.ace_gutter { | |
background: #3b3b3b; | |
color: rgb(153,153,153) | |
} | |
.ace_print-margin { | |
width: 1px; | |
background: #555; | |
} |
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
I am attesting that this GitHub handle thomasp85 is linked to the Tezos account tz2Pkj2xWJovKKCsABjnr3NbyMVJTMBkpTvb for tzprofiles | |
sig:spsig1Ehb3tCbCP8GEJnhztgv2fSLaSk2HYnNfuC5TczfrPC6DsXfqGNpiSPxj6PjyK3Z4hrQgbegczwP6GEek8HirA9FzoRGK9 |
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(tweenr) # Available on CRAN | |
library(ggforce) # Install from thomasp85/ggforce | |
library(gganimate) # Install from dgrtwo/gganimate | |
set.seed(2) | |
x <- sample(9,20, prob=c(1,2,3,4,5,4,3,2,1), replace=T) | |
df <- data.frame(x = x, y = 15) | |
dfs <- list(df) | |
for(i in seq_len(nrow(df))) { | |
dftemp <- tail(dfs, 1) | |
dftemp[[1]]$y[i] <- sum(dftemp[[1]]$x[seq_len(i)] == dftemp[[1]]$x[i]) |
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
--- | |
title: "ggplot2 examples and exercises" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` | |
This document contains all the code that is displayed during the workshop. The |
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(ggraph) | |
library(tidygraph) | |
library(gganimate) | |
# Data from http://konect.uni-koblenz.de/networks/sociopatterns-infectious | |
infect <- read.table('out.sociopatterns-infectious', skip = 2, sep = ' ', stringsAsFactors = FALSE) | |
infect$V3 <- NULL | |
names(infect) <- c('from', 'to', 'time') | |
infect$time <- as.POSIXct(infect$time, origin = Sys.time() - as.numeric(Sys.time())) |
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(ggplot2) | |
library(gganimate) | |
library(sf) | |
earth <- sf::st_as_sf(rnaturalearth::countries110) | |
views <- data.frame(rbind( | |
st_bbox(earth[earth$name == 'Denmark',]), | |
st_bbox(earth[earth$name == 'Australia',]) | |
)) | |
p <- ggplot() + | |
geom_sf(data = earth, fill = 'white') + |
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(ggraph) | |
library(gganimate) | |
library(igraph) | |
# Data from http://konect.uni-koblenz.de/networks/sociopatterns-infectious | |
infect <- read.table('out.sociopatterns-infectious', skip = 2, sep = ' ', stringsAsFactors = FALSE) | |
infect$V3 <- NULL | |
names(infect) <- c('from', 'to', 'time') | |
infect$timebins <- as.numeric(cut(infect$time, breaks = 100)) | |
# We want that nice fading effect so we need to add extra data for the trailing |
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
library(magick) | |
library(reshape2) | |
library(dplyr) | |
library(tidygraph) | |
library(particles) | |
library(animation) | |
plot_fun <- function(sim) { | |
df <- as_tibble(sim) | |
plot(df$x, df$y, col = df$color, pch = '.', axes = FALSE, xlim = c(-100, 317), ylim = c(-268, 100), xlab = NA, ylab = NA) |
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
--- | |
title: "PDF Animation Test" | |
output: pdf_document | |
header-includes: | |
- \usepackage{animate} | |
--- | |
`gganimate` now supports animations inside PDF documents. This feature is only | |
viewable with Acrobat Reader, however. Remember to include | |
`\usepackage{animate}` in the preamble and set `fig.show='animate'` in the chunk |
NewerOlder