I came up with a weekly R challenge, as a way to “force” myself into learning new things. One figure, every week! The catch is that every time I should be trying something new… maybe I’ll use a new type of visualization for first time, or maybe I’ll explore a new dataset. Initially I thought it would be neat if there was some unifying topic, e.g. water, but then I decided to keep it open.

1st of March aka Баба Марта day!

On 1st of March, in Bulgaria, we celebrate the beginning of the spring. It’s also known as Grandma March day (bg: Баба Марта). Grandma March is moody, today the sun may be shining, but tomorrow it may snow. Eventually, when Grandma March leaves, at the end of March, the spring arrives.

Usually, on 1&st of March, we gift our closest people with martenitsa (bg: мартеница). If you’re in Bulgaria on that day (or whitin March), you can see that EVERYONE is wearing them. Lots of them. It is a lovely holiday, when you select/prepare мартеници for all your friend and family. I love wearing it as a bracelet, but the most traditional one is with two figures (male & female). The pom-poms variety is also very popular.

I truly love this holiday and miss the martenitsa exchange with my friends and family. My mom sends me martenitsa with the post each year, no matter where I live (Denmark, USA, or Singapore). I love everything about this holiday, especially those two things about martenitsa:

Wikipedia provides a nice intro to martenitsa, so here is a short paragraph on the symbology:

The red and white woven threads symbolize the wish for good health. They are the heralds of the coming of spring and of new life. While white as a color symbolizes purity, red is a symbol of life and passion, and so some ethnologists have proposed that, in its very origins, the custom might have reminded people of the constant cycle of life and death, the balance of good and evil, and the sorrow and happiness in human life. The Martenitsa is also a stylized symbol of Mother Nature, the white symbolizing the purity of the melting white snow and the red setting of the sun, which becomes more and more intense as spring progresses.

Apparently, martenitsa is also on the UNESCO Representative List of the Intangible Cultural Heritage of Humanity since 2017 link.

So, since I’m far away from Bulgaria, and I spend quite a lot of time online, I decided to make a digital martenitsa and to gift it to everyone I know on social media. Of course, I’m using the chance also to practice plotting things in R, so this counts as the 6th entry for my weekly challenge, which is shaping to be 14-day challenge…

Technical details and code

I’m making pom-poms! The red color I use is the one from the Bulgarian flag (#D01C1F). I played for a while with the idea to use the green (from the flag) as a background, but it looked so bad, it almost caused me a headache. So, instead I use one of the lightest tints of the same red (#fadddd).

My digital martenitsa has 3 elements:

The pom-poms were made out of 5000 points each, whose x and y coordinates were sampled from a normal distribution with SD=0.3 (rnorm()).
The thread is made with segments with the coordinates of the pom-pom centers (the mean of the rnorm), and the center of the ribbon (x=0, y=0).
The ribbon was the “new” thing for me this time around. I used the parametric form of the equation of the lemniscate of Bernoulli, which I learned how to plot from this amazing post from x-engineer.org: “How to plot parametric equations with Scilab”. It’s great, check it out!

And that’s it!

Happy 1st of March! Честита Баба Марта!

library(scales)
# Lemniscate of Bernoulli (parametric form) for the martenitza ribbon
t <-seq(0, 2*pi, by=0.001)
a <- 2
x <- a*sqrt(cos(2*t))*cos(t)
y <- a*sqrt(cos(2*t))*sin(t)
# generating some random points for the martenitza pom-poms
set.seed(01032019)
y.pom <- rnorm(5000, -3, 0.3)
x1.pom <- rnorm(5000, -1, 0.3)
x2.pom <- rnorm(5000, 1, 0.3)
# setting the parameters of the plot
par(mar=c(1, 1, 1, 1), bg="#fadddd", bty="n", xpd=FALSE, family="mono") 
# plotting it all!
plot(x,y, type="l", col="#D01C1F", lwd=3, axes=FALSE, xlim=c(-4,4), ylim=c(-5,5))
lines(x, y, col="#FFFFFF", lty=2, lwd=2)
points(0, 0, col="#D01C1F", lwd=3, cex=2)
segments(0, 0, -1, -3, col="#D01C1F", lwd=3)
segments(0, 0, -1, -3, col="#FFFFFF", lty=2, lwd=2)
segments(0, 0, 1, -3, col="#D01C1F", lwd=3)
segments(0, 0, 1, -3, col="#FFFFFF", lty=2, lwd=2)
points(x1.pom, y.pom, col=alpha("#D01C1F", 0.5), pch=16)
points(x2.pom, y.pom, col=alpha("#FFFFFF", 0.5), pch=16)
# texts
text(0, 4, "Честита Баба Марта!", col="#D01C1F", cex=4)
mtext("@DenitzaV", side=1, line=0, adj = 1, col="#D01C1F")

LS0tDQp0aXRsZTogIk1hcnRlbml0c2EgUG9tLXBvbXMiDQphdXRob3I6ICJEZW5pdHphIEQuIFZvdXRjaGtvdmEiDQpkYXRlOiAiMjggRmViIDIwMTkgKCM2KSINCm91dHB1dDoNCiAgaHRtbF9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