Package 'ojothemes'

Title: OJO, OKPI, and TOK themes for ggplot2 and gt
Description: This package contains themes for ggplot2 plots and gt tables that follow the styles of OJO / OKPI / TOK.
Authors: Andrew Bell [cre, aut], Anthony Flores [aut], Brancen Gregory [aut]
Maintainer: Andrew Bell <[email protected]>
License: GPL (>= 3) + file LICENSE
Version: 1.1.3
Built: 2026-06-03 09:39:56 UTC
Source: https://github.com/openjusticeok/ojothemes

Help Index


geom_bar in the Open Justice Oklahoma style

Description

#' #' Submit ?ggplot2::geom_bar to see the full documentation for geom_bar()

Usage

geom_bar(mapping = NULL, width = 0.7, ...)

Arguments

mapping

mapping from ggplot2

width

bar width

...

other arguments passed to geom_bar()


geom_col in the Open Justice Oklahoma style

Description

A custom version of the geom_col() geom that uses the OJO version of the ggproto object instead of the default (this makes the bars skinnier and nice looking consistently)

Usage

geom_col(
  mapping = NULL,
  data = NULL,
  position = "stack",
  ...,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

Arguments

mapping

Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame., and will be used as the layer data.

position

Position adjustment, either as a string, or the result of a call to a position adjustment function.

...

Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like color = "red" or size = 3. They may also be parameters to the paired geom/stat.

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders.


geom_jitter in the Open Justice Oklahoma style

Description

#' Submit ?ggplot2::geom_jitter to see the full documentation for geom_jitter()

Usage

geom_jitter(mapping = NULL, size = 3, ...)

Arguments

mapping

mapping from ggplot2

size

point size

...

other arguments passed to geom_jitter()


geom_line in the Open Justice Oklahoma style

Description

Submit ?ggplot2::geom_line to see the full documentation for geom_line()

Usage

geom_line(mapping = NULL, linewidth = 1.5, ...)

Arguments

mapping

mapping from ggplot2

linewidth

line size

...

other arguments passed to geom_line()


geom_path in the Open Justice Oklahoma style

Description

Submit ?ggplot2::geom_path to see the full documentation for geom_path()

Usage

geom_path(mapping = NULL, size = 1, ...)

Arguments

mapping

mapping from ggplot2

size

line size

...

other arguments passed to geom_path()


geom_point in the Open Justice Oklahoma style

Description

Submit ?ggplot2::geom_point to see the full documentation for geom_point()

Usage

geom_point(mapping = NULL, size = 3, ...)

Arguments

mapping

mapping from ggplot2

size

point size

...

other arguments passed to geom_point()


geom_step in the Open Justice Oklahoma style

Description

Submit ?ggplot2::geom_step to see the full documentation for geom_step()

Usage

geom_step(mapping = NULL, size = 1, ...)

Arguments

mapping

mapping from ggplot2

size

line size

...

other arguments passed to geom_step()


geom_point in the Open Justice Oklahoma style

Description

Submit ?ggplot2::geom_point to see the full documentation for geom_point()

Usage

geom_text(mapping = NULL, size = 1/0.352777778, ...)

Arguments

mapping

mapping from ggplot2

size

text size

...

other arguments passed to geom_point()


OJO version of the ggproto GeomCol object

Description

This is a near-exact copy of the default ggplot2 GeomCol ggproto object. The only difference is that I've adjusted it to make the default column width smaller. This ensures that it looks right no matter what the scale of the data you're using.

Usage

GeomColOJO

Format

An object of class GeomCol (inherits from GeomRect, Geom, ggproto, gg) of length 4.


gt_base Function

Description

gt_base Function

Usage

gt_base(
  data,
  title = NA,
  subtitle = NA,
  font_size = 14,
  format_cols = TRUE,
  analyst_name = NA,
  source = NA
)

Arguments

data

A data frame to be converted into a gt table.

title

Optional. A title for the table. Default is NA.

subtitle

Optional. A subtitle for the table. Default is NA.

font_size

The font size for the table. Default is 14.

format_cols

Should gt::fmt_auto() be applied to all cols?

analyst_name

The name of the analyst to credit in the footnote

source

The source / domain of the data

Value

A gt table based on the input data frame with specified modifications.

Examples

## Not run: 
gt_base(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars")

## End(Not run)

gt_ojo Function

Description

gt_ojo Function

Usage

gt_ojo(
  data,
  title = NA,
  subtitle = NA,
  font_size = 14,
  chosen_font = "Roboto Mono",
  format_cols = TRUE,
  analyst_name = NA,
  source = NA
)

Arguments

data

A data frame to be converted into a gt table.

title

Optional. A title for the table. Default is NA.

subtitle

Optional. A subtitle for the table. Default is NA.

font_size

The font size for the table. Default is 14.

chosen_font

The font family to use. Default is Roboto mono

format_cols

Should gt::fmt_auto() be applied to all cols?

analyst_name

The name of the analyst to credit in the footnote

source

The source / domain of the data

Value

A gt table based on the input data frame with specified modifications.

Examples

## Not run: 
okpi_gt(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars")

## End(Not run)

gt_okpi Function

Description

gt_okpi Function

Usage

gt_okpi(
  data,
  title = NA,
  subtitle = NA,
  font_size = 14,
  chosen_font = "Roboto Condensed",
  format_cols = TRUE,
  analyst_name = NA,
  source = NA
)

Arguments

data

A data frame to be converted into a gt table.

title

Optional. A title for the table. Default is NA.

subtitle

Optional. A subtitle for the table. Default is NA.

font_size

The font size for the table. Default is 14.

chosen_font

The font family to use. Default is Roboto Condensed.

format_cols

Should gt::fmt_auto() be applied to all cols?

analyst_name

The name of the analyst to credit in the footnote

source

The source / domain of the data

Value

A gt table based on the input data frame with specified modifications.

Examples

## Not run: 
okpi_gt(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars")

## End(Not run)

OJO analyst name text

Description

A function to construct the analyst credit text

Usage

ojo_analyst_name_text(analyst_name = NA)

Arguments

analyst_name

The name of the analyst to credit

Value

A string with the analyst credit text


OJO gt caption / source note with defaults

Description

Wrapper for gt::tab_source_note() and gt::tab_footnote() with consistent defaults.

Usage

ojo_gt_captions(x, analyst_name = NA, source = NA)

Arguments

x

A gt object

analyst_name

The name of the analyst to credit

source

The data source / source of the data.


OJO ggplot labels with defaults

Description

Wrapper for ggplot2::labs() with consistent defaults.

Usage

ojo_labs(..., analyst_name = NA, source = NA)

Arguments

...

Other arguments passed to labs()

analyst_name

The name of the analyst to credit

source

The data source / source of the data.


OJO caption text

Description

Creates the text for a caption to add to ggplots and gt tables, including consistent default "source: " statements.

Usage

ojo_make_caption(analyst_name = NA, source = NA)

Arguments

analyst_name

The name of the analyst to credit

source

The domain / source of the data. Can be one of "oscn", "ocdc", or "ppb" for canned text, NA for no source, or a custom string.

Value

A string with the caption text


Use Oklahoma Policy Institute ggplot2 themes

Description

ojo_set_theme provides a ggplot2 theme formatted according to the Oklahoma Policy Institute style guide, with sensible defaults.

Usage

ojo_set_theme(
  theme = "okpi",
  base_size = 18,
  base_line_size = 0.5,
  base_rect_size = 0.5,
  scale = "continuous"
)

Arguments

theme

The theme you wish to use. Options are "okpi", "ojo", or "tok".

base_size

The base font size for the theme. All fonts are relative to this value.

base_line_size

The base line size for the theme. All line sizes are relative to this value.

base_rect_size

The base rect size for the theme. All rect sizes are relative to this value.

scale

For theme_ojo_map(). Should the legend theme be continuous or discrete?


OJO source text

Description

A function to construct the "Source:" note text

Usage

ojo_source_text(source = NA)

Arguments

source

The domain / source of the data. Can be one of "oscn", "ocdc", or "ppb" for canned text, NA for no source, or a custom string.

Value

A string with the source text


OKPI blue

Description

OKPI blue

Usage

okpi_blue

Format

An object of class character of length 1.


OKPI blue light

Description

OKPI blue light

Usage

okpi_blue_light

Format

An object of class character of length 1.


OKPI Blue palette

Description

OKPI Blue palette

Usage

okpi_blue_palette(n)

Arguments

n

The number of colors to return


OKPI Red

Description

OKPI Red

Usage

okpi_red

Format

An object of class character of length 1.


OKPI Red light

Description

OKPI Red light

Usage

okpi_red_light

Format

An object of class character of length 1.


OKPI Red palette

Description

OKPI Red palette

Usage

okpi_red_palette(n)

Arguments

n

The number of colors to return


OKPI yellow

Description

OKPI yellow

Usage

okpi_yellow

Format

An object of class character of length 1.


OKPI yellow light

Description

OKPI yellow light

Usage

okpi_yellow_light

Format

An object of class character of length 1.


OKPI Yellow palette

Description

OKPI Yellow palette

Usage

okpi_yellow_palette(n)

Arguments

n

The number of colors to return


OJO Cyan Palette

Description

OJO Cyan Palette

Usage

palette_ojo_cyan

Format

An object of class character of length 8.

Details

A vector with hex-color codes for the OJO cyan palette.


OJO Diverging Palette

Description

OJO Diverging Palette

Usage

palette_ojo_diverging

Format

An object of class character of length 8.

Details

A vector with hex-color codes for the OJO diverging palette.


OJO Gray Palette

Description

OJO Gray Palette

Usage

palette_ojo_gray

Format

An object of class character of length 8.

Details

A vector with hex-color codes for the OJO gray palette.


OJO Green Palette

Description

OJO Green Palette

Usage

palette_ojo_green

Format

An object of class character of length 8.

Details

A vector with hex-color codes for the OJO green palette.


OJO Magenta Palette

Description

OJO Magenta Palette

Usage

palette_ojo_magenta

Format

An object of class character of length 8.

Details

A vector with hex-color codes for the OJO magenta palette.


OJO Main Palette

Description

OJO Main Palette

Usage

palette_ojo_main

Format

An object of class character of length 8.


OJO Politics Palette

Description

OJO Politics Palette

Usage

palette_ojo_politics

Format

An object of class character of length 2.

Details

A vector with hex-color codes for the OJO politics palette.


OJO Quintile Palette

Description

OJO Quintile Palette

Usage

palette_ojo_quintile

Format

An object of class character of length 5.

Details

A vector with hex-color codes for the OJO quintile palette.


OJO Red Palette

Description

OJO Red Palette

Usage

palette_ojo_red

Format

An object of class character of length 8.

Details

A vector with hex-color codes for the OJO red palette.


OJO Space Gray Palette

Description

OJO Space Gray Palette

Usage

palette_ojo_spacegray

Format

An object of class character of length 8.

Details

A vector with hex-color codes for the OJO space gray palette.


OJO Yellow Palette

Description

OJO Yellow Palette

Usage

palette_ojo_yellow

Format

An object of class character of length 8.

Details

A vector with hex-color codes for the OJO yellow palette.


OKPI main palette

Description

OKPI Palettes

Usage

palette_okpi_main

Format

An object of class character of length 14.

Details

A vector with hex-color codes that correspond to the extended color palette outlined in the Open Justice Oklahoma Data Visualization Style Guide. http://openjusticeok.github.io/styleguide/


TOK main palette

Description

TOK main palette

Usage

palette_tok_main

Format

An object of class character of length 10.


OJO Color Scale

Description

This function returns a ggplot2 color scale using the OJO main palette.

Usage

scale_color_ojo()

Value

A ggplot2 scale object.

Examples

library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) +
  geom_point(size = 3) +
  scale_color_ojo()

OKPI Color Scale

Description

This function returns a ggplot2 color scale using the OKPI main palette.

Usage

scale_color_okpi()

Value

A ggplot2 scale object.

Examples

library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) +
  geom_point(size = 3) +
  scale_color_okpi()

TOK Color Scale

Description

This function returns a ggplot2 color scale using the TOK main palette.

Usage

scale_color_tok()

Value

A ggplot2 scale object.

Examples

library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) +
  geom_point(size = 3) +
  scale_color_tok()

OJO Fill Scale

Description

This function returns a ggplot2 fill scale using the OJO main palette.

Usage

scale_fill_ojo()

Value

A ggplot2 scale object.

Examples

library(ggplot2)
ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) +
  geom_bar() +
  scale_fill_ojo()

OKPI Fill Scale

Description

This function returns a ggplot2 fill scale using the OKPI main palette.

Usage

scale_fill_okpi()

Value

A ggplot2 scale object.

Examples

library(ggplot2)
ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) +
  geom_bar() +
  scale_fill_okpi()

TOK Fill Scale

Description

This function returns a ggplot2 fill scale using the TOK main palette.

Usage

scale_fill_tok()

Value

A ggplot2 scale object.

Examples

library(ggplot2)
ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) +
  geom_bar() +
  scale_fill_tok()

A ggplot2 theme formatted in the Oklahoma Policy Institute style

Description

theme_okpi provides a ggplot2 theme formatted according to the Oklahoma Policy Institute style guide for web, with sensible defaults, and also inclusdes the OKPI fill and color scales.

Usage

theme_ojo(
  base_size = 14,
  base_family = "Roboto Mono",
  base_line_size = 0.5,
  base_rect_size = 0.5
)

Arguments

base_size

The base font size to use; 14 is the default.

base_family

The font family to use; Roboto Condensed is the default.

base_line_size

The base line size to use; 0.5 is the default.

base_rect_size

The base rect size to use; 0.5 is the default.


A ggplot2 theme formatted in the Open Justice Oklahoma style

Description

theme_ojo provides a ggplot2 theme formatted according to the Open Justice Oklahoma style guide for web, with sensible defaults.

Usage

theme_ojo_base(
  base_size = 16,
  base_family = "Roboto Mono",
  base_line_size = 0.5,
  base_rect_size = 0.5
)

Arguments

base_family, base_size

base font family and size

base_line_size, base_rect_size

base line and rectangle sizes


A ggplot2 theme formatted in the Oklahoma Policy Institute style

Description

theme_okpi provides a ggplot2 theme formatted according to the Oklahoma Policy Institute style guide for web, with sensible defaults, and also inclusdes the OKPI fill and color scales.

Usage

theme_okpi(
  base_size = 14,
  base_family = "Roboto Condensed",
  base_line_size = 0.5,
  base_rect_size = 0.5
)

Arguments

base_size

The base font size to use; 14 is the default.

base_family

The font family to use; Roboto Condensed is the default.

base_line_size

The base line size to use; 0.5 is the default.

base_rect_size

The base rect size to use; 0.5 is the default.


A ggplot2 theme formatted in the Oklahoma Policy Institute style

Description

theme_okpi provides a ggplot2 theme formatted according to the Oklahoma Policy Institute style guide for web, with sensible defaults.

Usage

theme_okpi_base(
  base_size = 16,
  base_family = "Roboto Condensed",
  base_line_size = 0.5,
  base_rect_size = 0.5
)

Arguments

base_size

The base font size to use; 16 is the default.

base_family

The font family to use; Roboto Condensed is the default.

base_line_size

The base line size to use; 0.5 is the default.

base_rect_size

The base rect size to use; 0.5 is the default.


A ggplot2 theme formatted in the Oklahoma Policy Institute style

Description

theme_tok provides a ggplot2 theme formatted according to the Oklahoma Policy Institute style guide for web, with sensible defaults, and also inclusdes the tok fill and color scales.

Usage

theme_tok(
  base_size = 14,
  base_family = "Roboto Condensed",
  base_line_size = 0.5,
  base_rect_size = 0.5
)

Arguments

base_size

The base font size to use; 14 is the default.

base_family

The font family to use; Roboto Condensed is the default.

base_line_size

The base line size to use; 0.5 is the default.

base_rect_size

The base rect size to use; 0.5 is the default.


A ggplot2 theme formatted in the TOK style

Description

theme_tok provides a ggplot2 theme formatted according to the Together Oklahoma style guide for web, with sensible defaults.

Usage

theme_tok_base(
  base_size = 16,
  base_family = "Roboto Condensed",
  base_line_size = 0.5,
  base_rect_size = 0.5
)

Arguments

base_size

The base font size to use; 16 is the default.

base_family

The font family to use; Roboto Condensed is the default.

base_line_size

The base line size to use; 0.5 is the default.

base_rect_size

The base rect size to use; 0.5 is the default.


TOK Blue

Description

TOK Blue

Usage

tok_blue

Format

An object of class character of length 1.