Skip to content

Instantly share code, notes, and snippets.

View norberello's full-sized avatar
🐌
Megalaima haemacephala

Norberto Asensio norberello

🐌
Megalaima haemacephala
View GitHub Profile
@norberello
norberello / garden plots.R
Created May 31, 2022 17:33 — forked from rmcelreath/garden plots.R
Code for drawing the forking data gardens in Chapter 2 of "Statistical Rethinking" textbook
# functions for plotting garden of forking data plots
library(rethinking)
polar2screen <- function( dist, origin, theta ) {
## takes dist, angle and origin and returns x and y of destination point
vx <- cos(theta) * dist;
vy <- sin(theta) * dist;
c( origin[1]+vx , origin[2]+vy );
}