Guest User

Untitled

a guest
Jan 20th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. library(tidyverse)
  2.  
  3. my_grid <- tibble(
  4. x = c(1:30),
  5. y = c(1:30)
  6. ) %>% expand.grid()
  7.  
  8. my_grid <- my_grid %>%
  9. mutate(x_noise = rnorm(nrow(my_grid), mean=0, sd=0.1),
  10. y_noise = rnorm(nrow(my_grid), mean=0, sd=0.1),
  11. hue = runif(nrow(my_grid),min=0, max=2*pi),
  12. angle_45 = sample(seq(0,2*pi,by=pi/4),size=nrow(my_grid),replace=T),
  13. radius = ifelse(angle_45 %in% c(0,pi/2,pi,pi+(pi/2),2*pi),1,sqrt(2)))
  14.  
  15.  
  16.  
  17. my_grid %>%
  18. ggplot(aes(x=x,y=y)) +
  19. geom_point(size=10,shape=21, stroke=1, fill="#000000ae", color="#000000") +
  20. geom_point(aes(x,y=y), size=4, color="#ffffffde") +
  21. geom_spoke(aes(angle=angle_45,radius=radius),
  22. color="#ffffffde", size=1.5, lineend="round") +
  23. theme_void() +
  24. coord_fixed()
  25.  
  26.  
  27. ggsave("grid_pattern.png", width=9, height=9, dpi=200)
Add Comment
Please, Sign In to add comment