Maths Rose can be drawn using the following R function:
rose <- function(k = 4, ...) {
t <- seq(0, 4 * pi, length.out = 500)
r <- cos(k * t)
x <- r * cos(t)
y <- r * sin(t)
plot(c(-1, 1), c(-1, 1), type = "n", axes = FALSE, ann = FALSE)
polygon(x, y, ...)
}Different roses shown can be drawn with
nroses <- 100
kmin <- 4
kmax <- 7
ks <- runif(n = nroses, kmin, kmax)
for(i in 1:length(ks)) {
sel <- sample(1:2, 1)
rose(k = ks[i], border = c("red", "yellow")[sel], col = c("red", "yellow")[3 - sel])
mtext(paste("FeliƧ Sant Jordi", substr(Sys.Date(), 1, 4)), side = 3, col = "blue", line = 1, cex = 3)
}