For this week’s #TidyTuesday I recreated the scoreboard from this year’s Eurovision with ggplot.
code on GitHub
Here is a mini tutorial:
I used this image as reference
Arranging the ranks, flags, country names and points was pretty straightforward. I used {ggimage} for the flags, after getting iso2c codes from the country names with {countrycode}
At this point I was quite happy with the plot but I wanted to try filling the bars behind each country with a gradient fill. For that, I created a rect grob with {grid} and used linearGradient() for the fill. I then used {ggpp}’s geom_grob() to place and resize the grob
The background highlights were made with a circle grob, this time filled with a radialGradient(). I once again used geom_grob() to place the grob in two different positions with different sizes
The last thing I wanted to fix was the flags of Switzerland and Belgium that were breaking out of the background bars. I thought of changing the aspect ratio or size of those two flags in geom_image(), but that would either distort them or make them too small
In the reference image all the flags had the same aspect ratio, so I thought I should try masking the flags. For that I used with_mask() from {ggfx}. Here are the masks overlayed on the flags as rectangles, everything outside the grey part would not be visible
Not perfect but I considered it a success!
Here is the reference image and the final plot side by side. I considered recreating the cymatic pattern (https://eurovision.tv/mediacentre/logos-and-artwork) in the background but I quickly realised that it would be impossible 😀