The goal of harlem is to provide a collection of color palettes
inspired by iconic works from Harlem Renaissance artists. These palettes
are designed to bring artistic flair to your data visualizations in R.
Each palette draws from the colors of a specific artwork:
LawrenceStreetScene)BeardenConjurWoman), Collage
(BeardenCollage if included)DouglasAspects), Song
of the Towers (DouglasSongTowers)MotleyBlues), Nightlife
(MotleyNightlife)JohnsonHarlem), Going to Church
(JohnsonGoingChurch), Ascent of Ethiopia (JonesAscentEthiopia)JonesLaBaker), Ascent of
Ethiopia (JonesAscentEthiopia)SargentOctoroonGirl)DelaneySelfPortrait)HaydenFetiche)CharlesWhiteSoldier)WoodruffAmistad)By using these palettes, you can incorporate the vibrancy, contrast, and cultural context of Harlem Renaissance art directly into your ggplot2 charts or other R visualizations.
You can install the development version of harlem from GitHub Wwith:
# install.packages("devtools")
# devtools::install_github("sdhutchins/harlem")
install.packages("harlem", repos = c('https://sdhutchins.r-universe.dev', 'https://cloud.r-project.org'))
Below are sample visualizations with a few of these palettes.
JonesAscentEthiopia Palettelibrary(harlem)
library(ggplot2)
data(diamonds, package = "ggplot2")
palette <- harlem_palettes$JonesAscentEthiopia
ggplot(diamonds, aes(x = cut, fill = cut)) +
geom_bar() +
scale_fill_manual(values = palette) +
theme_minimal() +
labs(title = "Count of Diamonds by Cut",
x = "Cut", y = "Count")

MotleyBlues Palette# Build a continuous gradient from a palette
continuous_cols <- harlem_palette("MotleyBlues", n = 256, type = "continuous")
# Use a scatter plot to demonstrate continuous color scale
set.seed(1)
subset_diamonds <- diamonds[sample.int(nrow(diamonds), 2000), ]
ggplot(subset_diamonds, aes(x = carat, y = price, color = price)) +
geom_point(alpha = 0.6, size = 1.2) +
scale_color_gradientn(colors = continuous_cols) +
theme_minimal() +
labs(title = "Scatter with Motley Blues palette",
x = "Carat", y = "Price", color = "Price")

CharlesWhiteSoldier Paletteset.seed(123)
df <- data.frame(
dose = factor(rep(1:5, each = 10)),
len = c(rnorm(10, 10, 3),
rnorm(10, 14, 3),
rnorm(10, 18, 3),
rnorm(10, 22, 3),
rnorm(10, 26, 3))
)
# Box plot
p3 <- ggplot(df, aes(x = dose, y = len, fill = dose)) +
geom_boxplot(color = "black") +
scale_fill_manual(values = harlem_palettes$JohnsonGoingChurch) +
theme_minimal(base_size = 14) +
theme(legend.position = "top") +
labs(x = "dose", y = "len")
p3

You can view the list of available palettes with:
names(harlem_palettes)
#> [1] "LawrenceStreetScene" "BeardenConjurWoman" "DouglasAspects"
#> [4] "MotleyBlues" "JohnsonHarlem" "SargentOctoroonGirl"
#> [7] "DelaneySelfPortrait" "JonesLaBaker" "HaydenFetiche"
#> [10] "MotleyNightlife" "JonesAscentEthiopia" "CharlesWhiteSoldier"
#> [13] "DouglasSongTowers" "JohnsonGoingChurch" "LoisMailouJones"
#> [16] "WoodruffAmistad"
# Preview a few palettes
print_palette(harlem_palettes$MotleyNightlife)

print_palette(harlem_palettes$LoisMailouJones)

print_palette(harlem_palettes$BeardenConjurWoman)

The package provides two main functions:
harlem_palettes: A list containing all available palettesharlem_palette(): A function to generate palettes with options for
discrete or continuous outputprint_palette(): A function to visualize palettes# Get a specific palette
harlem_palettes$MotleyBlues
#> [1] "#8F1307" "#1F231C" "#BD8955" "#461303" "#6D1A08"
# Generate a continuous palette
harlem_palette("MotleyBlues", n = 10, type = "continuous")
#> [1] "#8F1307" "#5D1A10" "#2B2119" "#53452E" "#997248" "#A26E42" "#6D3A1E"
#> [8] "#4A1303" "#5B1605" "#6D1A08"
#> attr(,"class")
#> [1] "palette"
#> attr(,"name")
#> [1] "MotleyBlues"
# Print a palette
print_palette(harlem_palettes$LawrenceStreetScene)

If you would like to contribute to this package, please see the CONTRIBUTING.md guidelines.