misc functions and aesthetic elements for my personal website
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
R
README_files
man
.Rbuildignore
.gitignore
DESCRIPTION
NAMESPACE
README.Rmd
README.html
README.md
awtools.Rproj

README.md

a_theme

A simple, distilled, #rstats theme used mainly on www.austinwehrwein.com

The original a_theme uses fonts that can be found and downloaded from Google Fonts:

The new a_robot_theme uses fonts that can be found and downloaded from Google Fonts:

The new a_concert_theme uses fonts that can be found and downloaded from Google Fonts:

# Examples Here is a simple scatterplot with the original a_theme.

#devtools::install_github('awhstin/awtools')
library(awtools)
library(gcookbook)
library(ggplot2)
library(dplyr)

ggplot(heightweight,aes(x=ageYear,y=heightIn,color=ageYear))+
  geom_point()+
  a_theme()+
  labs(title='Height by Age',
       subtitle='Sample data of height in inches by age in years.',
       caption='Source: R Graphics Cookbook')

Here is an example of the color palette.

ggplot(uspopage, aes(x=Year, y=Thousands, fill=AgeGroup)) + 
  geom_area() +
  a_scale_fill() +
  scale_y_continuous(labels = scales::comma)+
  labs(title="Age distribution of population\nin the U.S., 1900-2002",
       subtitle="Example data from the R Graphics Cookbook.",
       caption="Source: R Graphics Cookbook") +
  a_theme() +
  theme(legend.position="bottom")

I also created a reverse of the color palette which is debuted along with the 'a_robot_theme'.

ggplot(uspopage, aes(x=Year, y=Thousands, fill=AgeGroup)) + 
  geom_area() +
  a_reversed_fill() +
  scale_y_continuous(labels = scales::comma)+
  labs(title="Age distribution of population\nin the U.S., 1900-2002",
       subtitle="Example data from the R Graphics Cookbook.",
       caption="Source: R Graphics Cookbook") +
  a_robot_theme() +
  theme(legend.position="bottom")

Finally for work I compare 4 and 6 factors often so I created a stepped version of my color palette.

I also created a reverse of the color palette which is seen below. There has been some work that requires a slightly more editorial style graph so here is also the debut of the 'a_concert_theme'.

groups<-unique(uspopage$AgeGroup)
uspopages<-uspopage%>%
  filter(uspopage$AgeGroup %in% head(groups,4))
ggplot(uspopages, aes(x=Year, y=Thousands, fill=AgeGroup)) + 
  geom_area() +
  a_step_fill() +
  scale_y_continuous(labels = scales::comma)+
  labs(title="Age distribution of population\nin the U.S., 1900-2002",
       subtitle="Example data from the R Graphics Cookbook.",
       caption="Source: R Graphics Cookbook") +
  a_concert_theme() +
  theme(legend.position="bottom")

Finally a little display of a new color palette.

groups<-unique(uspopage$AgeGroup)
uspopage<-uspopage%>%
  filter(uspopage$AgeGroup %in% head(groups,6))
ggplot(uspopage, aes(x=Year, y=Thousands, color=AgeGroup)) + 
  geom_line(size=1) +
  a_main_color() +
  scale_y_continuous(labels = scales::comma)+
  labs(title="Age distribution of population\nin the U.S., 1900-2002",
       subtitle="Example data from the R Graphics Cookbook.",
       caption="Source: R Graphics Cookbook") +
  a_concert_theme() +
  theme(legend.position="bottom")