Awesome
awtools
A simple, distilled, #rstats theme used mainly on www.austinwehrwein.com
<code>devtools::install_github('awhstin/awtools')</code>
The main theme is the <code>a_plex_theme</code> which the fonts are available from Google Fonts:
- IBM Plex Mono (plot title, legend)
- IBM Plex Sans (subtitle, captions, axis_text)
<code>a_dark_theme</code> shares mostly all the same elements of the main theme but the colors are adjusted to make a dark theme.
Palettes
pal.bands(ppalette,mpalette,spalette,gpalette,bpalette,labels = c('Primary','Flat','Secondary','Gray','Big'))
Examples
<code>a_plex_theme</code> features:
- 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.
All examples are made using the <code>gcookbook</code> package. Let's start with an example using the <code>a_plex_theme</code> with the <code>a_flat_color</code> palette.
ggplot(heightweight,aes(x=heightIn,y=weightLb, color = factor(round(ageYear)))) +
geom_point() +
a_plex_theme() +
a_flat_color() +
labs(
title='Height and Weight',
subtitle='Sample data of height inches and weight in pounds.',
caption='Source: R Graphics Cookbook',
color='Age'
)
Example of <code>a_dark_theme</code> with the primary color palette.
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(color=factor(carb), size=drat)) +
labs(x="Fuel efficiency (mpg)", y="Weight (tons)",
title="Basic scatterplot example",
subtitle="A demonstration",
caption="This be a caption") +
a_primary_color() +
a_dark_theme()
And a new <code>a_gray_color</code> and <code>a_gray_palette</code> 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_logical(),
## PRCP = col_double(),
## SNOW = col_logical(),
## SNWD = col_logical(),
## TAVG = col_double(),
## TMAX = col_double(),
## TMIN = col_double(),
## WDF2 = col_double(),
## WDF5 = col_double(),
## 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
Old
The original <code>a_theme</code> uses fonts that can be found and downloaded from Google Fonts:
The new <code>a_robot_theme</code> uses fonts that can be found and downloaded from Google Fonts:
- Roboto Slab (plot title, legend)
- Roboto Light (subtitle, captions, axis_text)
The new <code>a_concert_theme</code> uses fonts that can be found and downloaded from Google Fonts:
- Concert One (plot title, axis_title)
- Inconsolata (subtitle, captions, axis_text)
Here is a simple scatterplot with the original <code>a_theme</code>.
ggplot(heightweight,aes(x=ageYear,y=heightIn, color=sex))+
geom_point()+
a_theme()+
a_scale_color() +
labs(title='Height by Age',
subtitle='Sample data of height in inches by age in years.',
caption='Source: R Graphics Cookbook')
<code>a_robot_theme</code> gets the name from the use of Roboto and Roboto Slab for the base and plot title fonts.
ggplot(heightweight,aes(x=heightIn,y=ageYear, color = factor(round(ageYear)))) +
geom_point() +
a_robot_theme() +
a_flat_color() +
labs(
title='Height and Age',
subtitle='Sample data of height inches and age in years.',
caption='Source: R Graphics Cookbook',
color='Age'
)
The <code>a_concert_theme</code> was developed for a more editorial style visualization.
ggplot(climate,aes(x=Year,y=climate$Anomaly10y, color=Source)) +
geom_line(size=.75) +
a_concert_theme() +
a_primary_color() +
labs(
title='Temperature Anomaly',
subtitle='Anomaly in Celsius, smoothed over ten years',
caption='Source: R Graphics Cookbook',
y='Anomaly'
)