Learn R Programming

MSUthemes (version 1.0.0)

get_bigten_colors: Big Ten Institution Primary & Sceondary Color Palette

Description

Get Big Ten colors for specific institutions

Usage

get_bigten_colors(institutions, type = "primary")

Value

Named character vector of hex colors

Arguments

institutions

Character vector of institution names (should match names in bigten_colors_primary)

type

Either "primary" or "secondary" colors

Examples

Run this code
# Get primary colors for specific institutions
get_bigten_colors(c("Michigan", "Ohio State", "MSU"))

# Get secondary colors
get_bigten_colors(c("Michigan", "Northwestern"), type = "secondary")

# Use in ggplot with scale_fill_manual
library(ggplot2)
my_colors <- get_bigten_colors(c("Michigan", "Ohio State", "MSU"))
BigTenData <- data.frame(
  institution = c("Michigan", "Ohio State", "MSU"),
  value = c(10, 15, 20)
)
ggplot(data=BigTenData) +
  geom_bar(aes(x = institution, y = value, fill = institution),
           stat="identity") +
  scale_fill_manual(values = my_colors)

Run the code above in your browser using DataLab