Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://aidangildea.github.io/duke/

Creating a Color-Blind Friendly Duke Color Package.
https://aidangildea.github.io/duke/

Last synced: 3 days ago
JSON representation

Creating a Color-Blind Friendly Duke Color Package.

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
fig.width = 8,
fig.asp = 0.618
)
```

# duke

[![R-CMD-check](https://github.com/aidangildea/duke/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/aidangildea/duke/actions/workflows/R-CMD-check.yaml){.pkgdown-devel}
[![CRAN Status](https://www.r-pkg.org/badges/version/duke)](https://cran.r-project.org/package=duke){.pkgdown-release}

## Overview

**duke** allows users to generate visualizations with Duke's official suite of colors in a color blind friendly way. By using it alongside **ggplot2**, you can easily promote accessibility in the Duke community and beyond.

## Installation

You can install the official version of `duke` from CRAN with:

``` r
# Install duke directly:
install.packages("duke")
```
Or alternatively, you can install the development version from GitHub:

``` r
# install.packages("devtools")
devtools::install_github("aidangildea/duke")
```

## Usage

This package is fully integrated with ggplot2, and therefore, allows you to customize several visualization features such as the theme and color scales of your plots created with ggplot2.

## Example

By using **duke** functions, you can easily convert your visualizations to Duke official colors.

```{r plot}
library(ggplot2)
library(duke)

plot1 <- ggplot(mpg, aes(cty, hwy)) +
geom_point(aes(colour = fl)) +
labs(
title = "City Miles per Gallon vs. Highway Miles per Gallon By Fuel Type",
caption = "Data sourced from mpg in ggplot2 package.",
x = "City Miles per Gallon (MPG)",
y = "Highway Miles per Gallon (MPG)"
)

plot2 <- ggplot(mpg, aes(cty, hwy)) +
geom_point(aes(color = cyl)) +
labs(
title = "City Miles per Gallon vs. Highway Miles per Gallon By Cylinders",
caption = "Data sourced from mpg in ggplot2 package.",
x = "City Miles per Gallon (MPG)",
y = "Highway Miles per Gallon (MPG)"
)
```

Then, by pairing them with functions from this package, you can convert them into Duke-branded and colorblind-friendly versions.

```{r themeduke, message = FALSE}
plot1 +
theme_duke() +
scale_duke_color_discrete()

plot2 +
theme_duke() +
scale_duke_continuous()
```

## Questions

For further questions about this package and its use, please open an issue.