## Excercise 2.1

```{r Cake plot}
plot(NA, xlim = c(0, 10), ylim = c(0, 13), xlab = "", ylab = "", las = 1, bty = "n")

# Level 1
## Horizontal lines
lines(c(1, 9), c(1, 1))
lines(c(1, 9), c(3, 3))
## Vertical lines
lines(c(1, 1), c(1, 3))
lines(c(9, 9), c(1, 3))

#Color layer 1
polygon(c(1, 9, 9, 1, 1), c(1, 1, 3, 3, 1),
density = 200,        
border = 1,
col = "antiquewhite1")

# Level 2
## Horizontal line
lines(c(2, 8), c(5, 5))
## Vertical lines
lines(c(2, 2), c(3, 5))
lines(c(8, 8), c(3, 5))

#Color layer 2
polygon(c(2, 8, 8, 2, 2), c(3, 3, 5, 5, 3),
density = 150,        
border = 1,
col = "antiquewhite1")

# Level 3
## Horizontal lines
lines(c(3, 7), c(7, 7))
## Vertical lines
lines(c(3, 3), c(5, 7))
lines(c(7, 7), c(5, 7))

#Color layer 3
polygon(c(3, 7, 7, 3, 3), c(5, 5, 7, 7, 5),
density = 100,        
border = 1,
col = "antiquewhite1")

# Level 4
## Horizontal lines
lines(c(4, 6), c(9, 9))
## Vertical lines
lines(c(4, 4), c(7, 9))
lines(c(6, 6), c(7, 9))

#Color layer 4
polygon(c(4, 6, 6, 4, 4), c(7, 7, 9, 9, 7),
density = 50,        
border = 1,
col = "antiquewhite1")

#Jam layer 1
polygon(c(1, 9, 9, 1, 1), c(1.95, 1.95, 2.05, 2.05, 1.95), col = "red")

#Jam layer 2
polygon(c(2, 8, 8, 2, 2), c(3.95, 3.95, 4.05, 4.05, 3.95), col = "red")

#Jam layer 3
polygon(c(3, 7, 7, 3, 3), c(5.95, 5.95, 6.05, 6.05, 5.95), col = "red")

#Jam layer 4
polygon(c(4, 6, 6, 4, 4), c(7.95, 7.95, 8.05, 8.05, 7.95), col = "red")

# 1st layer Candles
k <- 9                             # number of candles
x <- seq(1.5, 8.5, length.out = k) # position of the candles
h <- 0.7                           # height of the candles
segments(x0 = x, x1 = x, y0 = rep(3, k), y1 = rep(3 + h, k), lwd = 3)

# 2nd layer Candles
k <- 7                             # number of candles
x <- seq(2.5, 7.5, length.out = k) # position of the candles
h <- 0.7                           # height of the candles
segments(x0 = x, x1 = x, y0 = rep(5, k), y1 = rep(5 + h, k), lwd = 3)

# 3rd layer Candles
k <- 5                             # number of candles
x <- seq(3.5, 6.5, length.out = k) # position of the candles
h <- 0.7                           # height of the candles
segments(x0 = x, x1 = x, y0 = rep(7, k), y1 = rep(7 + h, k), lwd = 3)

# 4th layer Candles
k <- 3                             # number of candles
x <- seq(4.25, 5.75, length.out = k) # position of the candles
h <- 0.7                           # height of the candles
segments(x0 = x, x1 = x, y0 = rep(9, k), y1 = rep(9 + h, k), lwd = 3)

## Candle layer 1
# Fire candle 1 1
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) - 2.75, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")
# Fire candle 1 2
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) - 1.85, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")
# Fire candle 1 3
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) - 0.95, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")
# Fire candle 1 4
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) - 0.1, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")
# Fire candle 1 5
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 0.75, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")
# Fire candle 1 6
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 1.65, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")
# Fire candle 1 7
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 2.5, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")
# Fire candle 1 8
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 3.4, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")
# Fire candle 1 9
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 4.25, c(10, 10.25, 10.75, 10.25, 10) - 6, col = "orange")

## Candle layer 2
# Fire candle 2 1
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) - 1.75, c(10, 10.25, 10.75, 10.25, 10) - 4, col = "orange")
# Fire candle 2 2
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) - 0.95, c(10, 10.25, 10.75, 10.25, 10) - 4, col = "orange")
# Fire candle 2 3
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) - 0.05, c(10, 10.25, 10.75, 10.25, 10) - 4, col = "orange")
# Fire candle 2 4
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 0.75, c(10, 10.25, 10.75, 10.25, 10) - 4, col = "orange")
# Fire candle 2 5
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 1.6, c(10, 10.25, 10.75, 10.25, 10) - 4, col = "orange")
# Fire candle 2 6
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 2.4, c(10, 10.25, 10.75, 10.25, 10) - 4, col = "orange")
# Fire candle 2 7
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 3.25, c(10, 10.25, 10.75, 10.25, 10) - 4, col = "orange")

## Candle layer 3
# Fire candle 3 1
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) - 0.75, c(10, 10.25, 10.75, 10.25, 10) - 2, col = "orange")
# Fire candle 3 2
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25), c(10, 10.25, 10.75, 10.25, 10) - 2, col = "orange")
# Fire candle 3 3
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 0.75, c(10, 10.25, 10.75, 10.25, 10) - 2, col = "orange")
# Fire candle 3 4
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 1.5, c(10, 10.25, 10.75, 10.25, 10) - 2, col = "orange")
# Fire candle 3 5
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 2.25, c(10, 10.25, 10.75, 10.25, 10) - 2, col = "orange")

## Candle layer 4
# Fire candle 4 1
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25), c(10, 10.25, 10.75, 10.25, 10), col = "orange")
# Fire candle 4 2
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 0.75, c(10, 10.25, 10.75, 10.25, 10), col = "orange")
# Fire candle 4 3
polygon(c(4.25, 4.35, 4.25, 4.15, 4.25) + 1.5, c(10, 10.25, 10.75, 10.25, 10), col = "orange") 

# Text I'm
polygon(c(2, 2.1, 2.1, 2, 2), c(11.1, 11.1, 13, 13, 11.1), col = "black")
polygon(c(2.2, 2.3, 2.3, 2.2, 2.2), c(12.5, 12.5, 13, 13, 12.5), col = "black")
polygon(c(2.4, 2.5, 2.5, 2.4, 2.4), c(11.1, 11.1, 13, 13, 11.1), col = "black")
polygon(c(2.6, 2.7, 2.7, 2.6, 2.6), c(11.1, 11.1, 13, 13, 11.1), col = "black")
polygon(c(2.8, 2.9, 2.9, 2.8, 2.8), c(11.1, 11.1, 13, 13, 11.1), col = "black")
polygon(c(2.4, 2.9, 2.9, 2.4, 2.4), c(12.5, 12.5, 13, 13, 12.5), col = "black")

# Text A
polygon(c(4.85, 4.95, 4.95, 4.85, 4.85), c(11.1, 11.1, 13, 13, 11.1), col = "black")
polygon(c(4.85, 5.15, 5.15, 4.85, 4.85), c(12.5, 12.5, 13, 13, 12.5), col = "black")
polygon(c(4.85, 5.15, 5.15, 4.85, 4.85), c(11.75, 11.75, 12.25, 12.25, 11.75), col = "black")
polygon(c(5.05, 5.15, 5.15, 5.05, 5.05), c(11.1, 11.1, 13, 13, 11.1), col = "black")

# Text Lie
polygon(c(7, 7.1, 7.1, 7, 7), c(11.1, 11.1, 13, 13, 11.1), col = "black")
polygon(c(7, 7.25, 7.25, 7, 7), c(11.1, 11.1, 11.6, 11.6, 11.1), col = "black")
polygon(c(7.35, 7.45, 7.45, 7.35, 7.35), c(11.1, 11.1, 13, 13, 11.1), col = "black")
polygon(c(7.55, 7.65, 7.65, 7.55, 7.55), c(11.1, 11.1, 13, 13, 11.1), col = "black")
polygon(c(7.55, 7.8, 7.8, 7.55, 7.55), c(11.1, 11.1, 11.6, 11.6, 11.1), col = "black")
polygon(c(7.55, 7.8, 7.8, 7.55, 7.55), c(12.5, 12.5, 13, 13, 12.5), col = "black")
polygon(c(7.55, 7.8, 7.8, 7.55, 7.55), c(11.75, 11.75, 12.25, 12.25, 11.75), col = "black")

#S/o Portal
```

