/rphl

R package with functions for common use in City of Philadelphia projects, including color palettes and graph themes compatible with ggplot2..

Primary LanguageRMIT LicenseMIT

rphl

The rphl package contains R code for quickly creating figures using the City of Philadelphia’s visual standards, including the color palette and typography.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("CityOfPhiladelphia/rphl")

In order to use the package, you will have to install Open Sans and Montserrat on your computer, and use the extrafont package to load the fonts into R:

# extrafont should install with rphl. If not, install from CRAN:
# install.packages("extrafont")
extrafont::font_import()

This step is only required once. Afterwards, rphl will automatically load the necessary fonts when attached with library(rphl).

Example

library(rphl)
#> Loading required package: extrafont
#> Registering fonts with R
library(ggplot2)
#> Registered S3 methods overwritten by 'ggplot2':
#>   method         from 
#>   [.quosures     rlang
#>   c.quosures     rlang
#>   print.quosures rlang
ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point(size = 3) +
  scale_color_phl() +
  labs(title = "Plot of Iris data using City of Philadelphia Standards",
       x = "Sepal Width", y = "Sepal Length") +
  theme_phl(base_size = 14)