Created
June 24, 2023 23:04
-
-
Save loukesio/32cdee509d99ad15677009912c94a76d to your computer and use it in GitHub Desktop.
This file contains hidden or 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(showtext) | |
| library(ggplot2) | |
| library(ggforce) | |
| library(tibble) | |
| library(ltc) | |
| library(showtext) | |
| ## Loading Google fonts (https://fonts.google.com/) | |
| font_add_google("Great Vibes", "Great Vibes") | |
| ## Automatically use showtext to render text | |
| showtext_auto() | |
| # Generate random circle parameters | |
| num_circles <- 100 | |
| circle_data <- tibble( | |
| x = runif(num_circles, 0, 1), | |
| y = runif(num_circles, 0, 1), | |
| radius = runif(num_circles, 0.01, 0.1), | |
| color = sample(ltc("dora", num_circles, "continuous"), num_circles) | |
| ) | |
| # Convert ltc color palette to a regular vector of colors | |
| ltc_palette <- ltc("dora", num_circles, "continuous") | |
| ltc_colors <- as.vector(ltc_palette) | |
| # Create the ggplot with circles | |
| ggplot() + | |
| geom_circle(data = circle_data, aes(x0 = x, y0 = y, r = radius, fill = color), color=NA, alpha=0.65) + | |
| scale_fill_manual(values = ltc_colors) + | |
| labs(title="Playing with ggforce...") + | |
| theme_void() + | |
| theme(legend.position = "none", | |
| plot.title=element_text(family="Great Vibes", size=28, hjust=0.5, color="#00798c"), | |
| panel.background = element_rect(fill = "#333333", color=NA), | |
| plot.background = element_rect(fill = "#333333", color=NA), | |
| panel.grid = element_blank(), | |
| panel.grid.major = element_blank(), | |
| panel.grid.minor = element_blank()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment