Make a Birthday Cake in R

Today is my friend’s BIG DAY! Happy Birthday!!! He is one of the four people who changed my life (yes four people have seminal impact in my life so far). I want to thank him for all the things he has done for me and all the opportunites he gave me. So I decide to make a birthday cake for him.

Here it is!!!

Sample Image Added via Markdown

Initially I was trying to make a 3D fancy cake in MATLAB, after one-hour struggling I realized how bad I am in MATLAB… so I turned to R for a simple 2D tasty cake lol.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
candle = function(pos)
{
x=pos[1]
y=pos[2]
rect(x,y,x+.2,y+2,col="red")
polygon(c(x+.05,x-.1,x+.1,x+.3,x+.15,x+0.05), c(y+2,y+2.3,y+2.6,y+2.3,y+2,y+2),col="#EECF08")

}

plot(c(0,10), c(0,10),type="n", bty="n",xaxt="n",yaxt="n", main="Cake", xlab="",ylab="")
draw.ellipse(5,2,col="#73EA71",a=4.4,b=1.7,border=1)
draw.ellipse(5,2,col="#BAE5FF",a=4,b=1.4,border=1)
rect(1,2,9,5,col="#BAE5FF",border="#BAE5FF")
lines(c(1,1),c(2,5))
lines(c(9,9),c(2,5))
draw.ellipse(5,5,col="#FCD2DE",a=4,b=1.4)

candle(c(2.5,4.5))
candle(c(3,5))
candle(c(4,4.5))
candle(c(5,5))
candle(c(6,4.5))
candle(c(7,5.2))

0%