Cannibus Curve with ggplot2

Starting today, recreational weed is legal in Canada. This news has some how lead me to find Cannibus Curve, a mathmatical equation to draw Cannibus….!!!

So to celebrate? being 2nd country in the world (1st was Uruguay) to legalize the green stuff for fun, I decided I’ll try drawing cannibus curve with ggplot. Here’s the final results.

Cannibus_Final

Here’s the step I took, because I couldn’t really understand the mathmatical equation, so I’ve break it down step by step to sort of understand what each part of equation is doing.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
library(tidyverse)

cannibus <- tibble(
 t = seq(-pi,pi, length.out=1000),
 r1 = (1+.9*cos(8*t)), ## this will draw 8 petals ## this number determines number of leafs!
 r2 = r1 * (1+.1*cos(24*t)), ## this make it pointy
 r3 = r2 * (.9+0.5*cos(200*t)), ## this makes it jaggy
 r4 = r3 * (1+sin(t)), ## Hmm.. I think I want to rorate it 90 degree... 
 r4_alt = r3 * (1+sin(t-pi/2)), ## one way to do it...
 r = (1+.9*cos(8*t)) * (1+.1*cos(24*t)) * (.9+0.5*cos(200*t)) * (1+sin(t)) ## Put all in line line!
) 

cannibus %>% 
 ggplot(aes(x=t, y=r1)) + 
 geom_path(color="#7ABA71", size=2) +
 coord_polar() +
 theme_void(base_family="Roboto Condensed") +
 labs(title = "(1+.9*cos(8*t) draws 8 petals")

1
2
3
4
5
6
cannibus %>% 
 ggplot(aes(x=t, y=r2)) + 
 geom_path(color="#7ABA71", size=2) +
 coord_polar() +
 theme_void(base_family="Roboto Condensed") +
 labs(title = "(1+.9*cos(8*t) * * (1+.1*cos(24*t)) makes the tip pointy")

1
2
3
4
5
6
cannibus %>% 
 ggplot(aes(x=t, y=r3)) + 
 geom_path(color="#7ABA71", size=0.5) +
 coord_polar() +
 theme_void(base_family="Roboto Condensed") +
 labs(title = "(1+.9*cos(8*t) * * (1+.1*cos(24*t)) * (.9+0.5*cos(200*t)) makes zaggy")

1
2
3
4
5
6
cannibus %>% 
 ggplot(aes(x=t, y=r4)) + 
 geom_path(color="#7ABA71", size=0.5) +
 coord_polar(start=pi/2) +
 theme_void(base_family="Roboto Condensed") +
 labs(title = "(1+.9*cos(8*t) * * (1+.1*cos(24*t)) * (.9+0.5*cos(200*t)) * (1+sin(t)) - OK Cool, Now 2 leaves are small!", subcaption="Notice I used start=pi/2 to rotate!")

1
2
3
4
5
6
cannibus %>% 
 ggplot(aes(x=t, y=r)) + 
 geom_polygon(fill="#499b4a", color="#74Ba71", size=0.1) +
 coord_polar(theta="x", start=pi/2) +
 theme_void(base_family="Roboto Condensed") +
 labs(title = "Instead of using geom_path, I used geom_polygon")

I couldn’t figure out how to “crop” the polar coordinate image, so there’s lots of white space on final image, but I like my little cannibus!

Related