Skip to content

Color Palette and Logos for the Fred Hutchinson Cancer Center

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

FredHutch/hutchplot

Repository files navigation

hutchplot

hutchplot is a color palette and logo package developed specifically for the Fred Hutchinson Cancer Center. This package leverages the power of palettes, an R package designed for working with color vectors and palettes and incorporates logos to the bottom right corner of plots generated by ggplot2.

The creation of hutchplot was a straightforward process that involved following the step-by-step instructions outlined in the “Creating a color palette package” vignette provided by the palettes R package.

❗ Currently, this package only includes the logo for the Fred Hutch Data Science Lab (dasl_logo()). If you want to include your own lab’s logo, please open an issue or submit a PR.

Installation

You can install the development version of hutchplot from GitHub with:

# install.packages("devtools")
devtools::install_github("fhdsl/hutchplot")

Using hutchplot with ggplot2

Code borrowed from Using palettes with ggplot2

library(hutchplot)
#> Loading required package: palettes
library(ggplot2)
library(scales)

Show Fred Hutch colors

plot(hutch_palette$hutch_colors)

For discrete colors, use scale_color_palette_d().

ggplot(diamonds[sample(nrow(diamonds), 1000), ], aes(carat, price)) +
  geom_point(aes(colour = color)) +
  scale_colour_palette_d(hutch_palette) +
  dasl_logo()

Note that hutch_palette consists of only 7 colors, which means plotting a categorical variable with more than 7 distinct values will throw an error.

ggplot(diamonds[sample(nrow(diamonds), 1000), ], aes(carat, price)) +
  geom_point(aes(colour = clarity)) +
  scale_colour_palette_d(hutch_palette) +
  dasl_logo()
#> Warning: This manual palette can handle a maximum of 7 values. You have
#> supplied 8.
#> Error in `vec_slice()`:
#> ! Can't subset elements past the end.
#> ℹ Location 8 doesn't exist.
#> ℹ There are only 7 elements.

Continuous or binned colors can be used with continuous data.

hwy_mpg <- ggplot(mpg, aes(displ, hwy, colour = hwy)) +
  geom_point()

For continuous colors use scale_color_palette_c().

hwy_mpg + 
  scale_colour_palette_c(hutch_palette) +
  dasl_logo()

For binned colors use scale_color_palette_b().

hwy_mpg + 
  scale_colour_palette_b(hutch_palette) +
  dasl_logo()

For discrete fills, use scale_fill_palette_d().

ggplot(diamonds, aes(x = price, fill = cut)) +
  geom_histogram(position = "dodge", binwidth = 1000) +
  scale_fill_palette_d(hutch_palette) +
  dasl_logo()

Continuous or binned fills can be used with continuous data.

eruptions <- ggplot(faithfuld, aes(waiting, eruptions, fill = density)) +
  geom_tile()

For continuous fills use scale_fill_palette_c().

eruptions + 
  scale_fill_palette_c(hutch_palette) +
  dasl_logo()

For binned fills use scale_fill_palette_b().

eruptions + 
  scale_fill_palette_b(hutch_palette) +
  dasl_logo()

About

Color Palette and Logos for the Fred Hutchinson Cancer Center

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages