Skip to content

Instantly share code, notes, and snippets.

View EdwinTh's full-sized avatar

Edwin Thoen EdwinTh

View GitHub Profile
precision_recall_plots <- function(cases_prop = .5,
precision = .8,
recall = .8) {
prec_point <- 1- cases_prop * 1/precision
recall_point <- 1 - recall
data.frame(x = c((1 -cases_prop) / 2,
(1 -cases_prop) + cases_prop / 2),
y = c(1, 1),
cases = c("0", "1")) %>%
@EdwinTh
EdwinTh / drunk_plot.r
Last active November 29, 2019 11:25
A drunk plot based on the work of Thomas Pedersen and Kara Woo
remotes::install_github("https://github.com/thomasp85/ggfx")
remotes::install_github("https://github.com/karawoo/ggbarf")
library(ggplot2)
library(patchwork)
drunk_plot <- function(drinks) {
if (drinks < 15) {
ggplot(mtcars, aes(mpg, disp)) +
ggfx::with_blur(geom_point(size = 3), sigma = 3 * drinks / 10) +