theme_moffitt: A Clean Theme with Moffitt Style

Description Usage Arguments Examples

View source: R/ggplot2_themes.R

Description

A clean theme based on hrbrthemes::theme_ispum() that uses Overpass, a free Google Font that resembles Freeway, the (proprietary) font chosen by MCC branding. This theme works best when set globally using ggplot2::theme_set() as it will automatically download and register the correct fonts from Google Font using sysfonts and showtext (if installed) and will change the default ggplot2::geom_text() related fonts as well. For an alternative look that I prefer, use theme_grk(), which simply uses "Fira Sans" as the base font.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
theme_moffitt(
  base_family = "Overpass",
  axis_text_family = "Overpass Mono",
  axis_title_family = base_family,
  axis_title_bold = FALSE,
  axis_title_just = "cc",
  axis_title_size = 13,
  subtitle_size = 13,
  default_geom_font = "Fira Sans Condensed",
  default_geom_color = grkmisc::moffitt_colors$blue,
  axis_text_color = "#6e6e6e",
  plot_caption_color = axis_text_color,
  panel_border_color = axis_text_color,
  panel_background_color = "#FFFFFF",
  ...,
  use_showtext = TRUE,
  panel_grid = c("major", "minor", "both", "none")
)

theme_grk(
  base_family = "PT Sans",
  axis_text_family = "PT Mono",
  axis_title_family = base_family,
  axis_title_bold = FALSE,
  axis_title_just = "cc",
  axis_title_size = 13,
  subtitle_size = 13,
  default_geom_font = "PT Sans Narrow",
  default_geom_color = grkmisc::moffitt_colors$blue,
  axis_text_color = "#6e6e6e",
  plot_caption_color = axis_text_color,
  panel_border_color = axis_text_color,
  panel_background_color = "grey96",
  ...,
  use_showtext = TRUE,
  panel_grid = c("major", "minor", "both", "none")
)

Arguments

base_family

base font family and size

axis_text_family

The font family for axis ticks text labels. Passed to family in axis.text in ggplot2::theme().

axis_title_family

axis title font family, face and size

axis_title_bold

If TRUE, the axis title's will be bold.

axis_title_just

axis title font justification, one of [blmcrt]

axis_title_size

axis title font family, face and size

subtitle_size

plot subtitle family, face and size

default_geom_font

Change the default ggplot2 geom fonts to the specified font. The default is "Fira Sans Condensed", which tends to look good in constrained space.

default_geom_color

Changes default colors of bars and points to the value given. Set to NULL to avoid changing these colors. Note that these colors are used only when color or fill is not mapped to the data.

axis_text_color

Color of axis text

plot_caption_color

Color of the plot caption text, or NULL to disable

panel_border_color

Color of the panel border, or NULL to disable

panel_background_color

Color of the panel background, or NULL to disable

...

Arguments passed on to hrbrthemes::theme_ipsum

base_size

base font family and size

plot_title_family

plot title family, face, size and margi

plot_title_face

plot title family, face, size and margi

plot_title_size

plot title family, face, size and margi

plot_title_margin

plot title family, face, size and margi

subtitle_family

plot subtitle family, face and size

subtitle_face

plot subtitle family, face and size

subtitle_margin

plot subtitle margin bottom (single numeric value)

strip_text_family

facet label font family, face and size

strip_text_face

facet label font family, face and size

strip_text_size

facet label font family, face and size

caption_family

plot caption family, face, size and margin

caption_face

plot caption family, face, size and margin

caption_size

plot caption family, face, size and margin

caption_margin

plot caption family, face, size and margin

axis_text_size

font size of axis text

axis_title_face

axis title font family, face and size

plot_margin

plot margin (specify with ggplot2::margin())

grid_col

grid & axis colors; both default to #cccccc

axis_col

grid & axis colors; both default to #cccccc

grid

panel grid (TRUE, FALSE, or a combination of X, x, Y, y)

axis

add x or y axes? TRUE, FALSE, "xy"

ticks

ticks if TRUE add ticks

use_showtext

Should showtext and sysfonts be used to register font families from Google? Default is TRUE.

panel_grid

One of "major", "minor", "both", or "none"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
theme_set(theme_moffitt())
theme_set(theme_grk())
# Set base theme without changing geom defaults
theme_set(theme_moffitt(default_geom_font = NULL, default_geom_color = NULL))

## End(Not run)

library(ggplot2)
g <- ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  geom_text(aes(label = cyl), vjust = 0.5, hjust = 1.65) +
  labs(x = "Fuel efficiency (mpg)",
       y = "Weight (tons)",
       title = "Seminal ggplot2 scatterplot example",
       subtitle = "A plot that is only useful for demonstration purposes",
       caption = "Brought to you by the letter 'g'")
g + theme_moffitt()
g + theme_moffitt(default_geom_color = moffitt_colors$green)
g + theme_grk()

GerkeLab/grkmisc documentation built on Feb. 23, 2020, 6:50 a.m.