Thanks to the incredible R packages aRt by nrennie and MetBrewer by BlakeRMills, this blue ombré banner is easy to recreate with a few simple lines of code. MetBrewer is my go-to for color palettes because it’s inspired by pieces of art from the Met…how cool! I used the palette Hokusai2, which is based on the painting Lake Suwa in Shinano Province (Shinshū Suwako) by Katsushika Hokusai.
Blue Ombré Banner Code
#Tenth Percentile Blue Ombré Banner
#libraries
suppressPackageStartupMessages(library(pacman))
p_load(tidyverse, aRt, MetBrewer)
#generate blue ombré image
stripes(perc=1, n=1, col_palette = met.brewer("Hokusai2", n=7), alpha = 1, s=1234)
#export image
#ggsave("filepath/filename.png")
ggsave("figure%03d.png")
The pacman package is a game changer. It conveniently allows you to load all your packages at once so you can avoid multiple lines of code. Another tip, if you don’t specify a file path and only include the file name, ggsave will save your image to the file path that your directory is set to (example below).
Rainbow Gradient Banner
You can swap out the colors by replacing Hokusai2 in the code above with another MetBrewer palette. The pretty reds and rich blues in the Nizami palette make for a really beautiful rainbow gradient.
This image is created by replacing the Hokusai2 palette with the Nizami palette and increase n to 10.
#generate rainbow gradient image
stripes(perc=1, n=1, col_palette = met.brewer("Nizami", n=10), alpha = 1, s=1234)
More aRt
I also love the National Parks palettes from kevinsblake, which was based on the MetBrewer package. And aRt has a lot of different functions to play around with, with outputs ranging from sunsetty gradients to Rorschach fractals to retro patterns. You can spend hours trying out different palette and function combinations to create unique designs. The following image is generated using the fractals function from aRt and the Glacier palette from NatParksPalettes.
#libraries
suppressPackageStartupMessages(library(pacman))
p_load(tidyverse, aRt, MetBrewer, NatParksPalettes)
#generate glacier fractal image
fractals(N = 25, col_palette = natparks.pals("Glacier", n = 25),
shift = 0, left = -1, right = 1,
y_param = 3, resolution = 0.005, dist_max = 4)
These packages are so fun to play around with, and generating aRt is such a great way to practice coding skills and error troubleshooting. Please share your creations by tagging @tenthpercentile on Instagram, I would love to see them!