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
## There's no need to generate progressive packed circle if you want grid of things... | |
df <- tibble( | |
x = rep(c(1:10), times=10), | |
y = rep(c(1:10), each=10), | |
radius = 0.5 | |
) | |
df_triangles <- circleLayoutVertices(df,npoints=8,sizetype="radius") | |
df_triangles_1 <- circleLayoutVertices(df %>% mutate(radius=sqrt(radius)), |
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(tidyverse) | |
cannabis_vertices <- function(xc,yc,radius,npoints=1000,...){ | |
radius=radius/100 | |
t = seq(-pi,pi, length.out=npoints+1) | |
m = (1+.9*cos(8*t)) * (1+.1*cos(24*t)) * (.9+0.5*cos(200*t)) * (1+sin(t)) | |
x = xc + m*radius * cos(t) | |
y = yc + m*radius * sin(t) | |
df <- tibble(x=x,y=y) |
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(tidyverse) | |
flower_vertices <- function(xc,yc,radius,k=5,offset=0,d=pi*(3-sqrt(5)),npoints=360,...){ | |
i = seq.int(0,npoints,by=1) | |
t = seq(0,2*pi, length.out=npoints+1) | |
tend = seq(0-d,2*pi-d, length.out=npoints+1) | |
m = sqrt(radius)*0.5 * cos(k * t) + offset | |
x = xc + m * cos(t) | |
y = yc + m * sin(t) | |
xend = xc + m * cos(tend) |
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(tidyverse) | |
base_grid <- tibble( | |
x = c(1:20), | |
y = c(1:20) | |
) %>% expand.grid | |
my_grid <- base_grid %>% | |
mutate(color=sample(c("#CFF09E","#A8DBA8","#79BD9A","#3B8686","#0B486B"), |
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(tidyverse) | |
library(imager) | |
library(scales) | |
peacock <- load.image("https://farm9.staticflickr.com/8126/8647827542_3f55baed69_z.jpg") | |
peacock_df <- peacock %>% |
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(tidyverse) | |
my_grid <- tibble( | |
x = c(1:30), | |
y = c(1:30) | |
) %>% expand.grid() | |
my_grid <- my_grid %>% | |
mutate(x_noise = rnorm(nrow(my_grid), mean=0, sd=0.1), | |
y_noise = rnorm(nrow(my_grid), mean=0, sd=0.1), |
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
draw_heart <- function(xc=0,yc=0,npoints=1000,radius=1,...){ | |
#area = pi*r*r for circle... this heart has area of 180 = r*r | |
t = seq(-pi,pi, length.out=npoints) | |
x = xc + 16 * radius *(sin(t))^3 | |
y = yc + radius*13*cos(t) - radius*5*cos(2*t) - radius*2*cos(3*t) - radius*cos(4*t) | |
df <- tibble(theta=t,x=x,y=y) | |
df %>% | |
mutate(color=sample(trippy,size=npoints,replace=T), |
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(tidyverse) | |
spiral_draw <- function(a=1,b=1,c=2,d=1,e=1,n=365,sn=18){ | |
df <-spiral_df <- tibble( | |
t = seq(0,sn*pi, length.out=n+1) | |
) %>% | |
mutate(r = a + b*t^(1/c), | |
x = r * cos(t*d), | |
y = r * sin(t*e)) | |
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(tidyverse) | |
df <- tibble( | |
t = seq(0,2*pi,length.out=1000), | |
x = cos(t), | |
y = sin(t) | |
) %>% mutate(idx = row_number(sample(t))) %>% | |
arrange(idx) | |
draw_yarn <- function(n=100){ |
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(tidyverse) | |
library(magick) | |
rotating_design <- function(shape=3,m=30){ | |
col_pal <- str_c(ggthemes::tableau_color_pal("Hue Circle")(19),"de") %>% |