BlakeRMills / MoMAColors

Color Schemes based around artwork and the Museum of Modern Art.
Other
181 stars 5 forks source link
colorpalettes data-visualization museums r

MoMAColors

Palettes inspired by works at the Museum of Modern Art in New York.

This is the sister package to MetBrewer, which contains color schemes based around artwork at the Metropolitan Museum of Art in New York. Structure of the package was based on coding from the PNWColors and wesanderson packages.

For requests, questions, comments, concerns, or any thing else, feel free to reach out to me:
My Website: Here
Twitter: Here
LinkedIn: Here
Email: blakerobertmills@gmail.com

Content

Installation

Palettes

Functions

Install Package

R

MoMAColors is currently only available through GitHub. Use the following code to download it in R.

# install.packages("devtools")
devtools::install_github("BlakeRMills/MoMAColors")

Palettes

All Palettes

AllPals

Abbott

Abbott

Alkalay1

Alkalay1

Alkalay2

Alkalay2

Althoff

Althoff

Andri

Andri

Avedon

Avedon

Budnitz

Budnitz

Clay

Clay

Connors

Connors

Dali

Dali

Doughton

Doughton

Ernst

Ernst

Exter

Exter

Flash

Flash

Fritsch

Fritsch

Kippenberger

Kippenberger

Klein

Klein

Koons

Koons

Levine1

Levine1

Levine2

Levine2

Liu

Liu

Lupi

Lupi

Ohchi

Ohchi

OKeeffe

OKeeffe

Palermo

Palermo

Panton

Panton

Picabia

Picabia

Picasso

Picasso

Rattner

Rattner

Sidhu

Sidhu

Smith

Smith

ustwo

ustwo

VanGogh

VanGogh

vonHeyl

vonHeyl

Warhol

Warhol

Functions

You can retrieve palettes using various methods listed below.

moma.colors("vonHeyl")

Ex1

moma.colors("Liu", n=6, type="discrete")

Ex2

moma.colors("Clay", 5)

Ex3

moma.colors("Ernst" , n=100, type="continuous")

Ex4

Displaying All Palettes

All palettes can be displayed at once using the display.all.moma function. This returns all palettes in their entirety if no n is provided.

display.all.moma()

Ex9

You are also able to enter the desired number of colors to view all palettes at the specific level.

display.all.moma(5)

Ex10

You are able to only view colorblind-friendly palettes with the colorblind_only parameter.

display.all.moma(colorblind_only = T)

Ex11

All other parameters in moma.colors can be passed into display.all.moma

display.all.moma(n=4, override_order = T, direction = -1)

Ex12

ggplot2 Examples

Here are also some ways you can incorporate this package into {ggplot2}

ggplot(data=iris, aes(x=Species, y=Petal.Length, fill=Species)) +
  geom_violin() +
  scale_fill_manual(values=moma.colors("Smith", 3))

Ex5

ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) +
  geom_point(size=2) +
  scale_color_moma_d("Liu")

Ex6

ggplot(data=iris, aes(x=Species, y=Sepal.Width, color=Sepal.Width)) +
  geom_point(size=3) +
  scale_color_gradientn(colors=moma.colors("Alkalay2"))

Ex7

library(urbnmapr)
countydata %>%
  left_join(counties, by = "county_fips") %>%
  filter(state_name =="Nebraska") %>%
  ggplot(mapping=aes(long,lat,group = group, fill = horate)) +
  geom_polygon(color="black",size=.25) +
  scale_fill_moma_c("Kippenberger") +
  coord_fixed() +
  labs(fill="Homeownership rate") +
  theme_void()

Ex8

Colorblind Friendly Checking

The package has been updated to check for colorblind-friendlyness You can list out the colorblind-friendly palettes with the following code

MoMAColors::colorblind_moma_palettes

 [1] "Alkalay1"     "Alkalay2"     "Althoff"      "Andri"        "Connors"      "Doughton"    
 [7] "Ernst"        "Exter"        "Flash"        "Fritsch"      "Kippenberger" "Koons"       
[13] "Levine2"      "Ohchi"        "OKeeffe"      "Palermo"      "Picabia"      "Picasso"     
[19] "Rattner"      "Sidhu"        "Smith"        "ustwo"        "VanGogh"      "vonHeyl"     

You can also test is a palettes is colorblind friendly using the function provided

MoMAColors::colorblind.friendly.moma("Palermo")
[1] TRUE

MoMAColors::colorblind.friendly.moma("Avedon")
[1] FALSE

Test Plots

The test.plots.moma function returns 4 different visualization types to get a quick glimse of how a desired palette would look in practice. This includes a starburst plot, a stream plot, a violin plot, and a stack bar chart. The test.plots.moma function can take all parameters that moma.colors is able to; however, plots cannot be generated when more than 26 colors are requested.

test.plots.moma("Picabia")

Ex13

test.plots.moma("Picasso", 5, direction = -1)

Ex14