Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. library(tidyverse)
  2. library(ggforce)
  3. library(patchwork)
  4. library(ggthemes)
  5.  
  6.  
  7. df <- tibble(
  8. t = seq(0,2*pi,length.out=61)
  9. ) %>% mutate(idx=row_number(),
  10. m = sqrt((idx%%2)+0.1),
  11. x = m*cos(t),
  12. y = m*sin(t))
  13.  
  14. df %>%
  15. filter(idx<nrow(df)) %>%
  16. ggplot(aes(x=x,y=y,group=idx%%3)) +
  17. geom_bspline_closed(radius=unit(2,"mm"), aes(fill=idx%%3), n=20) +
  18. geom_bspline_closed(expand=unit(2,"mm"), aes(fill=idx%%3), n=20) +
  19. coord_fixed() +
  20. theme_void() +
  21. scale_fill_viridis_c(alpha=0.3, end=0.8, option="magma", guide="none")
  22.  
  23.  
  24. df %>%
  25. filter(idx<nrow(df)) %>%
  26. ggplot(aes(x=x,y=y)) +
  27. geom_bspline_closed(radius=unit(2,"mm"), n=1000, alpha=0.2) +
  28. geom_bspline_closed(expand=unit(-2,"mm"), n=1000, alpha=0.8) +
  29. coord_fixed() +
  30. theme_void() +
  31. scale_fill_viridis_c(alpha=0.3, end=0.8, option="magma", guide="none") +
  32. geom_point(size=0.5) +
  33. geom_path(size=0.2) +
  34. geom_shape(size=0.3, expand=unit(-2,"mm"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement