README.md

urbnthemes

Travis-CI Build Status

Overview

urbnthemes is a set of tools for creating Urban Institute-themed plots and maps in R. The package extends ggplot2 with web, print, and map themes as well as tools that make plotting easier at the Urban Institute. urbnthemes replaces the urban_R_theme.

Installation

install.packages("devtools")
devtools::install_github("UI-Research/urbnthemes")

Fonts

The Urban Institute uses Lato font for publications. After installing urbnthemes, submit urbnthemes::lato_test() to see if Lato is imported and registered.

If Lato isn't imported and registered, install Lato and then submit urbnthemes::lato_install(). If you are on a Windows, you may need to install ghostscript and then submit Sys.setenv(R_GSCMD = "link to the ghostscript .exe") before running urbnthemes::lato_install().

Waffle charts with glyphs require fontawesome. fontawesome_test() and fontawesome_install() are the fontawesome versions of the above functions. Be sure to install fontawesome from here.

Usage

library(ggplot2)
library(urbnthemes)

set_urbn_defaults(style = "print")

ggplot(data = mtcars, mapping = aes(factor(cyl))) +
  geom_bar() + 
  scale_y_continuous(expand = expand_scale(mult = c(0, 0.1))) +
  labs(x = "Number of Cylinders",
       y = "Count") +
  remove_ticks()

library(ggplot2)
library(urbnthemes)
library(grid)
library(gridExtra)

set_urbn_defaults()

plot <- ggplot(data = mtcars, mapping = aes(factor(cyl))) +
  geom_bar() + 
  scale_y_continuous(expand = expand_scale(mult = c(0, 0.1))) +
  labs(x = "Number of Cylinders",
       y = "Count") +
  remove_ticks()

grid.arrange(plot, urbn_logo_text(), ncol = 1, heights = c(30, 1))

Core themes:

Formatting functions:

Utility functions:

In development:

Getting help

Contact Aaron Williams or Kyle Ueyama with feedback or questions.

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



UI-Research/urbnthemes documentation built on Aug. 26, 2018, 9:09 a.m.