knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", fig.align = "center" )
The rphl
package contains R code for quickly creating figures using the City of Philadelphia's visual standards, including the color palette and typography.
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)
.
library(rphl) library(ggplot2) 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.