Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://aidangildea.github.io/duke/
Creating a Color-Blind Friendly Duke Color Package.
https://aidangildea.github.io/duke/
Last synced: 2 days ago
JSON representation
Creating a Color-Blind Friendly Duke Color Package.
- Host: GitHub
- URL: https://aidangildea.github.io/duke/
- Owner: aidangildea
- License: other
- Created: 2022-11-18T02:52:22.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T20:50:27.000Z (11 months ago)
- Last Synced: 2024-10-28T17:27:39.131Z (19 days ago)
- Language: R
- Homepage: https://aidangildea.github.io/duke/
- Size: 79.4 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
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.