Created
January 4, 2023 19:28
-
-
Save martinmodrak/07b3a25e4cf555630b611d2b8f4af28c to your computer and use it in GitHub Desktop.
Profile and header picture for https://bayes.club/@statmodeling_bot
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
#Profile | |
ggplot(data.frame(x = 1:3, y = c(5, 7, 1)), aes(x, y)) + | |
geom_bar(stat = "identity", fill = "#6364ff", color = FALSE) + | |
theme_void() + | |
theme(plot.margin = margin(15,15,15,15)) | |
# Header | |
set.seed(55465) | |
x <- 0:100 | |
m <- splines::bs(x = x, df = 5, intercept = TRUE) %*% matrix(rnorm(5 * 50), ncol = 50, nrow = 5) | |
a <- data.frame(x = x, y = rowMeans(m)) | |
d <- tidyr::pivot_longer(data.frame(sample = 1:50, t(m)), cols = 2:(length(x) + 1), names_to = "x", values_to = "y", names_prefix = "X") | |
d$x <- as.numeric(d$x) - 1 | |
ggplot(d, aes(x, y + ((x - 50)/40) ^ 3 + (x/200) ^ 2)) + | |
geom_line(data = a, size = 2) + | |
geom_line(aes(group = sample), alpha = 0.7, color = "#6364ff") + | |
coord_cartesian(expand = FALSE) + | |
theme_void() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment