Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Palette and themes for Washington Soil Health Initiative branding

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

WA-Department-of-Agriculture/washi

Repository files navigation

CRAN statusCRAN downloads:name status badgewashi status badgeR-CMD-checkCodecov test coverage

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.

Video Walkthrough

Installation

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")

Fonts

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.

Palettes

To list the names of all available palettes, callnames(washi_pal). Toview a palette, use thewashi_pal_view() function.

All WaSHI standard colors

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 colors adjusted to be more color-blind friendly

washi_pal_view("color_blind")

Color gradients

Available in green, blue, red, and gold.

washi_pal_view("green_gradient",n=4,reverse=TRUE)

Data

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.

Plots

washi providesggplot2 scale and theme functions that apply WaSHIcolors, fonts, and styling.

Example workflow:

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))

Scatter plot

# 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()

Barplot

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())

Tables

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

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp