Valentine’s Day Marigold Flower

3 minute read

R is a tool for doing serious statistics and data analysis. But not everything in life has to be serious- life can be beautiful, and R can make beautiful things. We can make art like here, here or here.

So today, I wanted to create a marigold flower for the Valentine’s Day, and dedicate it to Love.

A rather short source code for this post can be found on my GitHub.

To begin with, the arrangement of leaves on a plant stem is ruled by spirals. This fact is called Phyllotaxis and it is a nice example of how mathematics can describe patterns in nature. There are many examples of natural facts that can be described in mathematical terms. Nice examples are the shape of snowflakes, the fractal geometry of romanesco broccoli or how self-similarity rules the growth of plants. So my goal is to invent a flower using this fact.

Just for an analogy, think of a marigold flower as a unit circle. As every (x, y) point should be in the unit circle, it follows that x² + y² = 1. We can get this using the super famous pythagorean trigonometric identity which states that sin²(θ) + cos²(θ) = 1 for any real number θ (theta). Think of this picture below as the marigold-

Similarly, plants arrange their leaves in spirals. A spiral is a curve which starts from the origin and moves away from this point as it revolves around it. In the plot above all our points are at the same distance from the origin. A simple way to arrange them in a spiral is to multiply x and y by a factor which increases for each point. We could use t as that factor, as it meets these conditions, but we will do something more harmonious. We will use the Golden Angle, which is Golden Angle = π(3 − √5).

The number we get from Golden Angle is inspired by the Golden Ratio, one of the most famous numbers in the history of mathematics. Both the Golden Ratio and the Golden Angle appear in unexpected places in nature. Apart of flower petals and plant leaves, you’ll find them in seed heads, pine cones, sunflower seeds, shells, spiral galaxies, hurricanes, etc.

Anyways here how out unit-circle marigold looks when we apply the Golden Angle= pi * (3 - sqrt(5))-

So we see that we put the Golden Angle= pi * (3 - sqrt(5)) to our unit-circle, it starts to look like a plant, but we can do it much better. So I changed the color, transparency (also called alpha), and size of the points, the image will become more appealing. Like here-

As you can see these patterns are very sensitive to the angle between the points that form the spiral. Any small changes to the angle can generate very different images. Let’s go even further….let’s set Golden Angle= 2, we get-

The patterns you’ve seen so far depends totally on this “Golden Angle” which gives out an infinite number of patterns inspired by nature: the only limit is our imagination. The image which you see below has a simple variation of the previous flower and is in essence very similar to the very first unit-circle image which I started this post with.

Therefore without boring you, the reader, or my love Fatima (Hi! if you’re reading this), here is the marigold flower:

And here is the code chunk that outputs the image above-

#Set the values of angle and points
golden_angle <- 13 * pi/180
points <- 2000 #sweet spot with this ratio

#create the formula
t <- (1:points) * golden_angle
x <- sin(t)
y <- cos(t)
df <- data.frame(t, x, y)

# create the  flower
ggplot(df, aes(x * t, y * t))+ 
   geom_point(size= 80, alpha= 0.1, 
               shape= 1, 
               color= "based on your prefrence")+
    #Some more boring code....             

If you want to learn more about the process and golden angle, read this Pricenton notes. This whole post was inspired from Mr. Antonio Sánchez Chinchón. I’ve made the flower with the spiral method, but there are additional methods, especially one with Fibonacci series, that produces even better results and more spirals as we increase the number of points.

Happy Valentine’s Day! And I hope that we can love one another, if nothing else, at least, respect one another.

NOTE: Thank you very much for reading! If you discover any mistakes or want to offer any feedback, please feel free to email me.