- Notifications
You must be signed in to change notification settings - Fork3
Palette and themes for Washington Soil Health Initiative branding
License
Unknown, MIT licenses found
Licenses found
WA-Department-of-Agriculture/washi
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Inspired by other branding R packages such asglitr,ratlas, andnmfspalette,washiprovides color palettes and themes consistent withWashington SoilHealth Initiative (WaSHI)branding. This package is to be used only by direct collaborators withinWaSHI, though you are welcome to adapt the package to suit your ownorganization’s branding.
Learn what functions are available and how to use them on thefunctionreferencewebpage.
For help within RStudio, place your cursor within the function name thenpress<F1> to open the help page or<F2> to open the function sourcecode.
Installwashi from CRAN with:
install.packages("washi")Or, you can install the development version ofwashi from ourr-universe with:
install.packages('washi',repos= c('https://wa-department-of-agriculture.r-universe.dev','https://cloud.r-project.org') )
Then load the package with:
library("washi")washi uses Poppins and Lato fonts through theragg andsystemfontspackages. You can install these fonts on your computer with:
# install.packages("ragg")# install.packages("systemfonts")washi_install_fonts()#> ℹ To install the fonts on Windows:#> • Select all .ttf files in the newly opened directory.#> • Right-click + Install.#> • Restart RStudio.
To make these fonts available in RStudio, set the Graphics backend touseAGG in the RStudio options dialog box.
To make these fonts available when knitting toRMarkdown orQuarto,use the following chunk setting:
knitr::opts_chunk$set(dev="ragg_png")
Learn more aboutragg in thepackagedocumentation and custom fonts fromJune Choe’s blogpost.
To list the names of all available palettes, callnames(washi_pal). Toview a palette, use thewashi_pal_view() function.
This palette is primarily to access individual brand colors for fonts,table headers, graphic backgrounds, etc. These colors, when usedtogether in plots, are not accessible to those who may have colorblindness.
Individual colors can be accessed withwashi_pal[["standard"]][["green"]].
washi_pal_view("standard")washi_pal_view("color_blind")Available in green, blue, red, and gold.
washi_pal_view("green_gradient",n=4,reverse=TRUE)
washi provides an example dataset, which was subset and anonymizedfrom theWaSHI State of the SoilsAssessment.This dataset comes in a long, tidy form with one measurement per row;and in a wide form with one sample per row. Its purpose is to provide anexample soils dataset to use in plots and tables.
washi providesggplot2 scale and theme functions that apply WaSHIcolors, fonts, and styling.
library(ggplot2)# 1. Prepare dataexample_data_long|> subset(measurement%in% c("total_c_percent","poxc_mg_kg")&!texture=="Loamy Sand")|># 2. Pipe to ggplot() ggplot(aes(x=value,fill=texture,color=texture))+ labs(title="Distribution of POXC (mg/kg) and Total C (%)",subtitle="Example with geom_density() and facet_wrap().", )+ geom_density(alpha=0.4)+ facet_wrap(.~measurement,scales="free")+# 3. Add washi_theme() with argument to change legend position washi_theme(legend_position="bottom")+# 4. Add washi_scale() washi_scale()+# 5. Tweak for your specific plot xlab(NULL)+ guides(col= guide_legend(nrow=2,byrow=TRUE))
# Single geom_point plotexample_data_wide|> subset(crop%in% c("Apple","Cherry","Potato"))|> ggplot(aes(x=ph,y=mn_mg_kg,color=crop))+ labs(title="Scatter plot of pH and Mn (mg/kg)",subtitle="Example with geom_point().",caption="This is a caption." )+ geom_point(size=2.5)+ washi_theme()+ washi_scale()
example_data_wide|> ggplot(aes(x=forcats::fct_rev(forcats::fct_infreq(crop))))+ geom_bar(fill=washi_pal[["standard"]][["blue"]])+ geom_text( aes(y= after_stat(count),label= after_stat(count) ),stat="count",hjust=2.5,color="white" )+# Flip coordinates to accomodate long crop names coord_flip()+ labs(title="Number of samples in each crop",subtitle="Example plot with geom_bar() without gridlines.",y=NULL,x=NULL )+# Turn gridlines off washi_theme(gridline_y=FALSE,gridline_x=FALSE)+# Remove x-axis theme(axis.text.x= element_blank())
washi provides a function to create aflextable with WaSHI colors,fonts, and styling.
ft<-example_data_wide|> head(5)|> subset(select= c("sample_id","crop","total_n_percent","total_c_percent" ))|> washi_flextable(cols_bold=1)
About
Palette and themes for Washington Soil Health Initiative branding
Resources
License
Unknown, MIT licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.











