R Rainbows: Making a Pride Flag in R

🌈HAPPY PRIDE MONTH!! Fun fact: my rainbow Twitter banner (which I keep up year-round) was actually made using R! Given that pride season is officially upon us, I thought it’d be fun to share the code I wrote to generate a quick, fun ggplot rainbow flag. To make the flag, I wrote a function, rainbow_flag(), which depends on one parameter, n. This will control how many colors of the rainbow I want to use (see examples below).