“The greatest value of a picture is when it forces us to notice what we never expected to see.” - John Tukey
Color is one of the most important attributes of a figure. Dedicated choice of color can help us deliver our idea more vividly.
The goal of paintingr
is to provide a set of palettes from paintings.
Structure of the package was based on coding from the wesanderson packages.
You can install the paintingr
with:
install.packages('paintingr')
Or the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("thereallda/paintingr")
library(paintingr)
# display all palettes
display_all_palettes()
Girl with a Pearl Earring - Johannes Vermeer (1665), Source
paint_palette("Pearlgirl")
A Bigger Splash - David Hockney (1967), Source
paint_palette("Splash")
Autumn at Oirase - Kawase Hasui (1933), Source
paint_palette("Autumn")
Matin à Villeneuve - Henri Biva (1905), Source
paint_palette("Villeneuve")
Ophelia - John Everett Millais (1851-1852), Source
paint_palette("Ophelia")
Kitchen (Detail 2) - Liza Lou (1991–1996), Source
paint_palette("Kitchen")
SPRING BY THE SEINE - Claude Monet (1875), Source
paint_palette("Spring")
Strawberries - Édouard Manet (1882), Source
paint_palette("Strawberries")
Seascape at Saintes-Maries - Vincent van Gogh (1888), Source
paint_palette("Seascape")
Twilight, Venice - Claude Monet (1908), Source
paint_palette("Twilight")
Abstract Composition - Jessica Dismorr (1915), Source
paint_palette("Abstract")
Vesuvius in Eruption - Joseph Wright of Derby (1776-1780), Source
paint_palette("Vesuvius")
ggplot2
-based examples
Use type="continuous"
to automatically interpolate between colors if
you want more colors than the palette can offer (n > 5/6).
library(ggplot2)
# Dummy data
x <- LETTERS[1:20]
y <- paste0("var", seq(1,20))
data <- expand.grid(X=x, Y=y)
data$Z <- seq(1,20)+runif(400, 0, 5)
# Heatmap
pal <- paint_palette("Autumn", n=100, type="continuous")
ggplot(data, aes(X, Y, fill= Z)) +
geom_tile() +
scale_fill_gradientn(colours = pal) +
scale_x_discrete(expand = c(0, 0)) +
scale_y_discrete(expand = c(0, 0)) +
coord_equal()
# Heatmap with palette of "Vesuvius"
pal2 <- paint_palette("Vesuvius", n=100, type="continuous")
ggplot(data, aes(X, Y, fill= Z)) +
geom_tile() +
scale_fill_gradientn(colours = pal2) +
scale_x_discrete(expand = c(0, 0)) +
scale_y_discrete(expand = c(0, 0)) +
coord_equal()
# use iris data from `ggplot2` for demonstration
data(iris)
ggplot(iris, aes(Species, Sepal.Length)) +
geom_boxplot(aes(fill = Species)) +
theme_classic() +
theme(legend.position = "top") +
scale_fill_manual(values = paint_palette("Villeneuve"))
# Scatter
ggplot(iris, aes(Sepal.Length, Sepal.Width)) +
geom_point(aes(color = Species)) +
theme_classic() +
theme(legend.position = "top") +
scale_color_manual(values = paint_palette("Kitchen"))
data(mpg)
# violin plot with 7 colors, Spring palette only have six colors add one more
ggplot(mpg, aes(x=class, y=hwy, fill=class)) +
geom_violin() +
theme_classic() +
scale_fill_manual(values = c(paint_palette("Spring", n=6), "black"))
ggplot(mpg, aes(x = class, fill = drv)) +
geom_bar() +
theme_classic() +
scale_fill_manual(values = paint_palette("Ophelia"))