Skip to contents

This is an internal package for R for the Rest of Us.

Installation

Install with the remotes package:

remotes::install_github("https://github.com/rfortherestofus/rfortherestofus")

rru_colors() demo

The function returns a named vector of colors used in R for the Rest of Us plots, and elsewhere. These are based on the website:

  • Blue - #6caadd : the blue from the logo
  • Dark Text - #314D63 : the dark blue text colour from the website
  • Light Text - #8394A1 : a lighter variant of the dark blue text color
  • Pale Blue - #E1EEF8 : a pale blue based on the logo blue, which is currently used for gridlines
rfortherestofus::rru_colors()
##       Blue  Dark Text Light Text  Pale Blue 
##  "#6caadd"  "#314D63"  "#8394A1"  "#E1EEF8"
rfortherestofus::rru_colors("Dark Text", "Pale Blue")
## [1] "#314D63" "#E1EEF8"

theme_rru() demo

It uses the font “Inter”, which is available via Google Fonts. Make sure you install it on your device and import it into R before making use of this theme.

library(tidyverse)

palmerpenguins::penguins %>%
  ggplot() +
  geom_point(aes(x = bill_length_mm,
                 y = flipper_length_mm,
                 color = species,
                 size = body_mass_g)) +
  labs(title = "Perfectly proportional penguins",
       subtitle = "Just *look* at them go!",
       x = "Bill length (mm)",
       y = "Flipper length (mm)") +
  colorblindr::scale_color_OkabeIto() +
  guides(size = "none") +
  rrutemplates::theme_rru()

palmerpenguins::penguins %>%
  ggplot(aes(x = 1,
             fill = species),
         stat = "count") +
  geom_bar() +
  xlim(c(-0.5, 2)) +
  coord_polar(theta = "y") +
  labs(title = "Perfectly proportional penguins",
       subtitle = "Look at them go!",
       caption = "Data from {palmerpenguins}") +
  colorblindr::scale_fill_OkabeIto() +
  rrutemplates::theme_rru(void = TRUE) +
  theme(legend.position = "right",
        plot.caption = element_text(hjust = 0.5))