| 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 |
#' #' Submit ?ggplot2::geom_bar to see the full documentation for geom_bar()
geom_bar(mapping = NULL, width = 0.7, ...)geom_bar(mapping = NULL, width = 0.7, ...)
mapping |
mapping from ggplot2 |
width |
bar width |
... |
other arguments passed to |
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)
geom_col( mapping = NULL, data = NULL, position = "stack", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )geom_col( mapping = NULL, data = NULL, position = "stack", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
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. |
#' Submit ?ggplot2::geom_jitter to see the full documentation for geom_jitter()
geom_jitter(mapping = NULL, size = 3, ...)geom_jitter(mapping = NULL, size = 3, ...)
mapping |
mapping from ggplot2 |
size |
point size |
... |
other arguments passed to |
Submit ?ggplot2::geom_line to see the full documentation for geom_line()
geom_line(mapping = NULL, linewidth = 1.5, ...)geom_line(mapping = NULL, linewidth = 1.5, ...)
mapping |
mapping from ggplot2 |
linewidth |
line size |
... |
other arguments passed to |
Submit ?ggplot2::geom_path to see the full documentation for geom_path()
geom_path(mapping = NULL, size = 1, ...)geom_path(mapping = NULL, size = 1, ...)
mapping |
mapping from ggplot2 |
size |
line size |
... |
other arguments passed to |
Submit ?ggplot2::geom_point to see the full documentation for geom_point()
geom_point(mapping = NULL, size = 3, ...)geom_point(mapping = NULL, size = 3, ...)
mapping |
mapping from ggplot2 |
size |
point size |
... |
other arguments passed to |
Submit ?ggplot2::geom_step to see the full documentation for geom_step()
geom_step(mapping = NULL, size = 1, ...)geom_step(mapping = NULL, size = 1, ...)
mapping |
mapping from ggplot2 |
size |
line size |
... |
other arguments passed to |
Submit ?ggplot2::geom_point to see the full documentation for geom_point()
geom_text(mapping = NULL, size = 1/0.352777778, ...)geom_text(mapping = NULL, size = 1/0.352777778, ...)
mapping |
mapping from ggplot2 |
size |
text size |
... |
other arguments passed to |
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.
GeomColOJOGeomColOJO
An object of class GeomCol (inherits from GeomRect, Geom, ggproto, gg) of length 4.
gt_base Function
gt_base( data, title = NA, subtitle = NA, font_size = 14, format_cols = TRUE, analyst_name = NA, source = NA )gt_base( data, title = NA, subtitle = NA, font_size = 14, format_cols = TRUE, analyst_name = NA, source = NA )
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 |
A gt table based on the input data frame with specified modifications.
## Not run: gt_base(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars") ## End(Not run)## Not run: gt_base(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars") ## End(Not run)
gt_ojo Function
gt_ojo( data, title = NA, subtitle = NA, font_size = 14, chosen_font = "Roboto Mono", format_cols = TRUE, analyst_name = NA, source = NA )gt_ojo( data, title = NA, subtitle = NA, font_size = 14, chosen_font = "Roboto Mono", format_cols = TRUE, analyst_name = NA, source = NA )
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 |
A gt table based on the input data frame with specified modifications.
## Not run: okpi_gt(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars") ## End(Not run)## Not run: okpi_gt(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars") ## End(Not run)
gt_okpi Function
gt_okpi( data, title = NA, subtitle = NA, font_size = 14, chosen_font = "Roboto Condensed", format_cols = TRUE, analyst_name = NA, source = NA )gt_okpi( data, title = NA, subtitle = NA, font_size = 14, chosen_font = "Roboto Condensed", format_cols = TRUE, analyst_name = NA, source = NA )
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 |
A gt table based on the input data frame with specified modifications.
## Not run: okpi_gt(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars") ## End(Not run)## Not run: okpi_gt(data = mtcars, title = "Motor Trend Car Road Tests", subtitle = "From mtcars") ## End(Not run)
A function to construct the analyst credit text
ojo_analyst_name_text(analyst_name = NA)ojo_analyst_name_text(analyst_name = NA)
analyst_name |
The name of the analyst to credit |
A string with the analyst credit text
Wrapper for gt::tab_source_note() and gt::tab_footnote() with consistent defaults.
ojo_gt_captions(x, analyst_name = NA, source = NA)ojo_gt_captions(x, analyst_name = NA, source = NA)
x |
A gt object |
analyst_name |
The name of the analyst to credit |
source |
The data source / source of the data. |
Wrapper for ggplot2::labs() with consistent defaults.
ojo_labs(..., analyst_name = NA, source = NA)ojo_labs(..., analyst_name = NA, source = NA)
... |
Other arguments passed to labs() |
analyst_name |
The name of the analyst to credit |
source |
The data source / source of the data. |
Creates the text for a caption to add to ggplots and gt tables, including consistent default "source: " statements.
ojo_make_caption(analyst_name = NA, source = NA)ojo_make_caption(analyst_name = NA, source = NA)
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. |
A string with the caption text
ojo_set_theme provides a ggplot2 theme formatted according to the
Oklahoma Policy Institute style guide, with sensible defaults.
ojo_set_theme( theme = "okpi", base_size = 18, base_line_size = 0.5, base_rect_size = 0.5, scale = "continuous" )ojo_set_theme( theme = "okpi", base_size = 18, base_line_size = 0.5, base_rect_size = 0.5, scale = "continuous" )
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 |
A function to construct the "Source:" note text
ojo_source_text(source = NA)ojo_source_text(source = NA)
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. |
A string with the source text
OKPI blue
okpi_blueokpi_blue
An object of class character of length 1.
OKPI blue light
okpi_blue_lightokpi_blue_light
An object of class character of length 1.
OKPI Blue palette
okpi_blue_palette(n)okpi_blue_palette(n)
n |
The number of colors to return |
OKPI Red
okpi_redokpi_red
An object of class character of length 1.
OKPI Red light
okpi_red_lightokpi_red_light
An object of class character of length 1.
OKPI Red palette
okpi_red_palette(n)okpi_red_palette(n)
n |
The number of colors to return |
OKPI yellow
okpi_yellowokpi_yellow
An object of class character of length 1.
OKPI yellow light
okpi_yellow_lightokpi_yellow_light
An object of class character of length 1.
OKPI Yellow palette
okpi_yellow_palette(n)okpi_yellow_palette(n)
n |
The number of colors to return |
OJO Cyan Palette
palette_ojo_cyanpalette_ojo_cyan
An object of class character of length 8.
A vector with hex-color codes for the OJO cyan palette.
OJO Diverging Palette
palette_ojo_divergingpalette_ojo_diverging
An object of class character of length 8.
A vector with hex-color codes for the OJO diverging palette.
OJO Gray Palette
palette_ojo_graypalette_ojo_gray
An object of class character of length 8.
A vector with hex-color codes for the OJO gray palette.
OJO Green Palette
palette_ojo_greenpalette_ojo_green
An object of class character of length 8.
A vector with hex-color codes for the OJO green palette.
OJO Magenta Palette
palette_ojo_magentapalette_ojo_magenta
An object of class character of length 8.
A vector with hex-color codes for the OJO magenta palette.
OJO Main Palette
palette_ojo_mainpalette_ojo_main
An object of class character of length 8.
OJO Politics Palette
palette_ojo_politicspalette_ojo_politics
An object of class character of length 2.
A vector with hex-color codes for the OJO politics palette.
OJO Quintile Palette
palette_ojo_quintilepalette_ojo_quintile
An object of class character of length 5.
A vector with hex-color codes for the OJO quintile palette.
OJO Red Palette
palette_ojo_redpalette_ojo_red
An object of class character of length 8.
A vector with hex-color codes for the OJO red palette.
OJO Space Gray Palette
palette_ojo_spacegraypalette_ojo_spacegray
An object of class character of length 8.
A vector with hex-color codes for the OJO space gray palette.
OJO Yellow Palette
palette_ojo_yellowpalette_ojo_yellow
An object of class character of length 8.
A vector with hex-color codes for the OJO yellow palette.
OKPI Palettes
palette_okpi_mainpalette_okpi_main
An object of class character of length 14.
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
palette_tok_mainpalette_tok_main
An object of class character of length 10.
This function returns a ggplot2 color scale using the OJO main palette.
scale_color_ojo()scale_color_ojo()
A ggplot2 scale object.
library(ggplot2) ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) + geom_point(size = 3) + scale_color_ojo()library(ggplot2) ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) + geom_point(size = 3) + scale_color_ojo()
This function returns a ggplot2 color scale using the OKPI main palette.
scale_color_okpi()scale_color_okpi()
A ggplot2 scale object.
library(ggplot2) ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) + geom_point(size = 3) + scale_color_okpi()library(ggplot2) ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) + geom_point(size = 3) + scale_color_okpi()
This function returns a ggplot2 color scale using the TOK main palette.
scale_color_tok()scale_color_tok()
A ggplot2 scale object.
library(ggplot2) ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) + geom_point(size = 3) + scale_color_tok()library(ggplot2) ggplot(mtcars, aes(x = wt, y = mpg, color = factor(gear))) + geom_point(size = 3) + scale_color_tok()
This function returns a ggplot2 fill scale using the OJO main palette.
scale_fill_ojo()scale_fill_ojo()
A ggplot2 scale object.
library(ggplot2) ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) + geom_bar() + scale_fill_ojo()library(ggplot2) ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) + geom_bar() + scale_fill_ojo()
This function returns a ggplot2 fill scale using the OKPI main palette.
scale_fill_okpi()scale_fill_okpi()
A ggplot2 scale object.
library(ggplot2) ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) + geom_bar() + scale_fill_okpi()library(ggplot2) ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) + geom_bar() + scale_fill_okpi()
This function returns a ggplot2 fill scale using the TOK main palette.
scale_fill_tok()scale_fill_tok()
A ggplot2 scale object.
library(ggplot2) ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) + geom_bar() + scale_fill_tok()library(ggplot2) ggplot(mtcars, aes(x = factor(gear), fill = factor(gear))) + geom_bar() + scale_fill_tok()
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.
theme_ojo( base_size = 14, base_family = "Roboto Mono", base_line_size = 0.5, base_rect_size = 0.5 )theme_ojo( base_size = 14, base_family = "Roboto Mono", base_line_size = 0.5, base_rect_size = 0.5 )
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. |
theme_ojo provides a ggplot2 theme formatted according to the
Open Justice Oklahoma style guide for web, with sensible defaults.
theme_ojo_base( base_size = 16, base_family = "Roboto Mono", base_line_size = 0.5, base_rect_size = 0.5 )theme_ojo_base( base_size = 16, base_family = "Roboto Mono", base_line_size = 0.5, base_rect_size = 0.5 )
base_family, base_size
|
base font family and size |
base_line_size, base_rect_size
|
base line and rectangle sizes |
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.
theme_okpi( base_size = 14, base_family = "Roboto Condensed", base_line_size = 0.5, base_rect_size = 0.5 )theme_okpi( base_size = 14, base_family = "Roboto Condensed", base_line_size = 0.5, base_rect_size = 0.5 )
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. |
theme_okpi provides a ggplot2 theme formatted according to the
Oklahoma Policy Institute style guide for web, with sensible defaults.
theme_okpi_base( base_size = 16, base_family = "Roboto Condensed", base_line_size = 0.5, base_rect_size = 0.5 )theme_okpi_base( base_size = 16, base_family = "Roboto Condensed", base_line_size = 0.5, base_rect_size = 0.5 )
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. |
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.
theme_tok( base_size = 14, base_family = "Roboto Condensed", base_line_size = 0.5, base_rect_size = 0.5 )theme_tok( base_size = 14, base_family = "Roboto Condensed", base_line_size = 0.5, base_rect_size = 0.5 )
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. |
theme_tok provides a ggplot2 theme formatted according to the
Together Oklahoma style guide for web, with sensible defaults.
theme_tok_base( base_size = 16, base_family = "Roboto Condensed", base_line_size = 0.5, base_rect_size = 0.5 )theme_tok_base( base_size = 16, base_family = "Roboto Condensed", base_line_size = 0.5, base_rect_size = 0.5 )
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
tok_bluetok_blue
An object of class character of length 1.