A simple, distilled, #rstats theme used mainly on www.austinwehrwein.com
My main theme now is the a_plex_theme
which the fonts are available from Google Fonts:
- IBM Plex Mono (plot title, legend)
- Open Sans (subtitle, captions, axis_text)
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:
- Roboto Slab (plot title, legend)
- Roboto Light (subtitle, captions, axis_text)
The new a_concert_theme
uses fonts that can be found and downloaded from Google Fonts:
- Concert One (plot title, axis_title)
- Inconsolata (subtitle, captions, axis_text)
- grid: [TRUE/FALSE] turns off the main panel grids.
- noaxis: [TRUE/FALSE] turns off the axis of the plot, seen mainly in maps.
- emphasis: ['x','y','xy'] adds a bold to an axis title for emphasis.
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_primary_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_plex_theme() +
theme(legend.position="bottom")
A new update to the awtools package sees a new dark theme that is based on the main plex theme.
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_dark_theme() +
theme(legend.position="bottom")
And a new a_gray_color
and a_gray_palette
which is a simple four color grays palette.
lax<-read_csv('https://raw.githubusercontent.com/awhstin/temperaturesv2/master/LAX-NCDC-2015-18.csv') %>%
filter(months(DATE)=='January')%>%
mutate(year=format(DATE,'%Y'),
month=factor(months(DATE), levels=rev(month.name)))
## Parsed with column specification:
## cols(
## STATION = col_character(),
## NAME = col_character(),
## DATE = col_date(format = ""),
## AWND = col_double(),
## PGTM = col_character(),
## PRCP = col_double(),
## SNOW = col_character(),
## SNWD = col_character(),
## TAVG = col_integer(),
## TMAX = col_integer(),
## TMIN = col_integer(),
## WDF2 = col_integer(),
## WDF5 = col_integer(),
## WSF2 = col_double(),
## WSF5 = col_double()
## )
ggplot(lax, aes(x=TAVG, y=month, fill=year)) +
geom_density_ridges(scale=.9, color=NA) +
a_plex_theme(grid=FALSE) +
a_gray_fill()
## Picking joint bandwidth of 1.23
Here is a simple scatterplot with the original a_theme
.
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")