The goal of pdwtheme is to build out the framework for a consistent color and style theme for visualization work that I do.
Note: This is my first package: 1. A lot of it was built using the example written up by: @drsimonj (https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2) 1. I have also been working through the R packages book as I have been working to try to figure out how to turn this into a package and is semi robust.
And the current version from GitHub with:
# install.packages("devtools")
devtools::install_github("phildwalker/pdwtheme")
# or via
remotes::install_github("phildwalker/pdwtheme", ref = "main")
This is a basic example which shows you how to solve a common problem:
library(pdwtheme)
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 3.6.3
theme_set(theme_minimal())
## basic example code
# Color by discrete variable using default palette
ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
geom_point(size = 4) +
scale_color_pdw()
# Fill by discrete variable with different palette + remove legend (guide)
ggplot(mpg, aes(manufacturer, fill = manufacturer)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
scale_fill_pdw(palette = "mixed", guide = "none")
# Fill by discrete variable with different palette + remove legend (guide)
ggplot(mpg, aes(manufacturer, fill = manufacturer)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
scale_fill_pdw(palette = "main", guide = "none")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.