Title: | ATLAS Formatting Functions and Templates |
---|---|
Description: | Provides templates, formatting tools, and 'ggplot2' themes tailored for the Accessible Teaching, Learning, and Assessment Systems (ATLAS) organization. These templates facilitate the creation of topic guides and technical reports, while the formatting functions enable users to customize numbers and tables to meet specific requirements. Additionally, the themes ensure a uniform visual style across graphics. |
Authors: | W. Jake Thompson [aut, cre] , Noelle Pablo [aut], Jeffrey Hoover [aut] , University of Kansas [cph, fnd] |
Maintainer: | W. Jake Thompson <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0.9000 |
Built: | 2024-11-08 23:19:39 UTC |
Source: | https://github.com/atlas-aai/ratlas |
The ratlas package serves three main purposes:
Project templates for topic guides and technical reports
Functions for formatting
Consistent ggplot2 themes
Maintainer: W. Jake Thompson [email protected] (ORCID)
Authors:
Noelle Pablo [email protected]
Jeffrey Hoover [email protected] (ORCID)
Other contributors:
University of Kansas [copyright holder, funder]
Useful links:
Report bugs at https://github.com/atlas-aai/ratlas/issues
Confused about whether a number should be written out ("five") or use numerals ("5")? Use this function! Most useful for R Markdown in-text writing.
apa_words(x, ordinal = FALSE)
apa_words(x, ordinal = FALSE)
x |
The number to be printed |
ordinal |
Do you want the ordinal numbering (e.g., 1st, 6th, etc.) |
A character string
apa_words(5) apa_words(16) apa_words(6, ordinal = TRUE)
apa_words(5) apa_words(16) apa_words(6, ordinal = TRUE)
Add row and/or column summaries (e.g., total counts) to a data frame.
append_summary(df, ..., row = TRUE, col = TRUE, .f = sum, args = NULL)
append_summary(df, ..., row = TRUE, col = TRUE, .f = sum, args = NULL)
df |
A data frame to append summaries to. |
... |
Unquoted names of columns to be included in the summary |
row |
logical indicating whether a summary row should be added (i.e., summarizing each column) |
col |
logical indicating whether a summary column should be added (i.e., summarizing each row) |
.f |
Function to use for calculating summaries |
args |
A named list of arguments to pass to |
A data frame with the summary row and/or column appended
set.seed(9416) df <- tibble::tibble(char = letters[1:5], x = rnorm(5), y = rnorm(5)) append_summary(df, x, y, row = TRUE, col = TRUE, .f = sum) append_summary(df, x, y, row = FALSE, .f = mean)
set.seed(9416) df <- tibble::tibble(char = letters[1:5], x = rnorm(5), y = rnorm(5)) append_summary(df, x, y, row = TRUE, col = TRUE, .f = sum) append_summary(df, x, y, row = FALSE, .f = mean)
Combine N and Percent Columns for Accessibility
combine_n_pct(df, n, pct, name, remove = TRUE, na_replace = NULL)
combine_n_pct(df, n, pct, name, remove = TRUE, na_replace = NULL)
df |
A data frame that has already been sent to |
n |
The unquoted name of the column containing count values |
pct |
The unquoted name of the column containing percentage values |
name |
The name of the new combined column to be created |
remove |
Logical. Should the existing |
na_replace |
Character string representing how missing values should be represented. |
A data frame.
pcts <- tibble::tibble(Program = c("A", "B", "C", "D", "E", "F"), n = 0:5, p = 0.5 * (0:5)) pcts |> fmt_table() |> combine_n_pct(n = n, pct = p, name = "States")
pcts <- tibble::tibble(Program = c("A", "B", "C", "D", "E", "F"), n = 0:5, p = 0.5 * (0:5)) pcts |> fmt_table() |> combine_n_pct(n = n, pct = p, name = "States")
A dataset contain information for how linkage levels are stored in the database, their official names, and their values for scoring.
dlm_ll_info
dlm_ll_info
A data frame with 13 rows and 4 variables:
subject
: The subject area for the linkage level
linkage_level
: The linkage level name as it is stored in the database
name
: The official linkage level name (public facing)
value
: The value used for scoring (i.e., the linkage level order, within
subject)
R variable aliases for commonly used vector and values.
dlm_ll dlm_grades dlm_complexity
dlm_ll dlm_grades dlm_complexity
An object of class character
of length 7.
An object of class character
of length 16.
An object of class character
of length 4.
dlm_ll
contains all linkage level names for ELA, mathematics, and science.
dlm_grades
contains all DLM grade levels.
dlm_complexity
contains all complexity band names for ELA, mathematics,
science, writing, and communication.
Format a String with Italics for HTML or Latex Output
fmt_italic(string, indicator = "*", html = TRUE)
fmt_italic(string, indicator = "*", html = TRUE)
string |
The character vector to add italics to. |
indicator |
The indicator for which words should be italicized |
html |
Logical for whether the output should be HTML. If |
A character vector
fmt_italic("Make *this* italic.", html = TRUE) fmt_italic("Make *this* italic.", html = FALSE)
fmt_italic("Make *this* italic.", html = TRUE) fmt_italic("Make *this* italic.", html = FALSE)
Create a kable table with some reasonable ATLAS defaults.
fmt_kbl( x, booktabs = TRUE, linesep = "", centering = FALSE, escape = FALSE, position = "left", latex_options = "HOLD_position", ... )
fmt_kbl( x, booktabs = TRUE, linesep = "", centering = FALSE, escape = FALSE, position = "left", latex_options = "HOLD_position", ... )
x |
For |
booktabs |
T/F for whether to enable the booktabs format for tables. I personally would recommend you turn this on for every latex table except some special cases. |
linesep |
By default, in booktabs tables, |
centering |
T (default)/F. Whether to center tables in the table environment. |
escape |
Boolean; whether to escape special characters when producing
HTML or LaTeX tables. When |
position |
This is the "real" or say floating position for the latex
table environment. The |
latex_options |
A character vector for LaTeX table options. Please see
package vignette for more information. Possible options include
|
... |
Additional parameters passed to |
A kable object.
fmt_kbl(mtcars[, 1:3], align = c("r", "c", "r"), col.names = c("Column 1", "Column 2", "Column 3"), caption = "Example Table Title")
fmt_kbl(mtcars[, 1:3], align = c("r", "c", "r"), col.names = c("Column 1", "Column 2", "Column 3"), caption = "Example Table Title")
Apply some default formatting to the header row of a kable table. Should be
called after any calls to kableExtra::column_spec()
.
fmt_kbl_header( kable_input, row = 0, align = "c", extra_css = "border-bottom: 0.16em solid #111111", ... )
fmt_kbl_header( kable_input, row = 0, align = "c", extra_css = "border-bottom: 0.16em solid #111111", ... )
kable_input |
Output of |
row |
A numeric value or vector indicating which row(s) to be selected. You don't need to count in header rows or group labeling rows. |
align |
A character string for cell alignment. For HTML, possible values could
be |
extra_css |
Extra css text to be passed into the cells of the row. Note that it's not for the whole row. |
... |
Additional arguments passed to |
A kable object.
fmt_kbl(mtcars[, 1:3], align = c("r", "c", "r"), col.names = c("Column 1", "Column 2", "Column 3"), caption = "Example Table Title") |> kableExtra::column_spec(1, width = "20em") |> fmt_kbl_header()
fmt_kbl(mtcars[, 1:3], align = c("r", "c", "r"), col.names = c("Column 1", "Column 2", "Column 3"), caption = "Example Table Title") |> kableExtra::column_spec(1, width = "20em") |> fmt_kbl_header()
Automatic formatting for tables that should "just work" for most use cases. For more fine-grained control, see formatting and padding.
fmt_table( df, dec_dig = 1, prop_dig = 3, corr_dig = 3, output = NULL, fmt_small = TRUE, max_value = NULL, keep_zero = FALSE )
fmt_table( df, dec_dig = 1, prop_dig = 3, corr_dig = 3, output = NULL, fmt_small = TRUE, max_value = NULL, keep_zero = FALSE )
df |
A data frame or tibble to be formatted for printing in output. |
dec_dig |
The number of decimal places to include for numbers, e.g.,
|
prop_dig |
The number of decimal places to include for numbers bounded
between [0,1], e.g., |
corr_dig |
The number of decimal places to include for numbers bounded
between [-1,1], e.g., |
output |
The output format of the table. One of "latex" or "html". Automatically pulled from document output type if not specified. |
fmt_small |
Indicator for replacing zero with |
max_value |
If |
keep_zero |
If |
A tibble with the same rows and columns as df
, with numbers
formatted consistently and padded for alignment when printed.
Other formatters:
formatting
,
padding
pcts <- tibble::tibble(n = 0:5, p = 0.5 * (0:5)) pcts |> fmt_table()
pcts <- tibble::tibble(n = 0:5, p = 0.5 * (0:5)) pcts |> fmt_table()
font_an
== "Arial Narrow
"
font_an
font_an
length 1 character vector
These formatting functions are used to format numerical values in a consistent manner. This is useful for printing numbers inline with text, as well as for formatting tables. Many of the included formatting functions were adapted from TJ Mahr's printy package.
fmt_count(x, big_interval = 3L, big_mark = ",") fmt_digits( x, digits = 3, fmt_small = FALSE, max_value = NULL, keep_zero = FALSE ) fmt_leading_zero(x) fmt_minus(x, output = NULL) fmt_replace_na(x, replacement = "—") fmt_corr(x, digits, output = NULL) fmt_prop(x, digits, fmt_small = TRUE, keep_zero = FALSE) fmt_prop_pct(x, digits = 0, fmt_small = TRUE)
fmt_count(x, big_interval = 3L, big_mark = ",") fmt_digits( x, digits = 3, fmt_small = FALSE, max_value = NULL, keep_zero = FALSE ) fmt_leading_zero(x) fmt_minus(x, output = NULL) fmt_replace_na(x, replacement = "—") fmt_corr(x, digits, output = NULL) fmt_prop(x, digits, fmt_small = TRUE, keep_zero = FALSE) fmt_prop_pct(x, digits = 0, fmt_small = TRUE)
x |
Number or number string to be formatted |
big_interval |
Interval indicating where to place numeric dividers |
big_mark |
Character used as mark between big interval before the decimal |
digits |
Number of decimal places to retain |
fmt_small |
Indicator for replacing zero with |
max_value |
If |
keep_zero |
If |
output |
The output type for the rendered document. One of |
replacement |
The value to use when replacing missing values |
fmt_count()
is a wrapper for base::prettyNum()
. Prints a number with
a big_mark
between every big_interval
.
fmt_digits()
is a wrapper for base::sprintf()
. Prints a number with
digits
number of decimal places, without losing trailing zeros, as happens
with base::round()
.
fmt_leading_zero()
removes the leading zero for decimal values.
fmt_minus()
replaces hyphens with the HTML minus sign (−
).
fmt_replace_na()
replaces NA
values with a specified replacement. This is
useful for formatting tables, when blanks are not desired. The default
behavior is to replace missing values with an em-dash (—
).
fmt_prop_pct()
formats proportions as percentages. This takes a number
bounded between 0 and 1, multiplies it by 100, and then rounds to the
specified number of digits using fmt_digits()
.
Two additional formatters are provided to format numbers according to the
American Psychological Association (APA) style guide. The 7th edition of the
APA style guide specifies that numbers bounded between [-1, 1] should not
include the leading zero (section 6.36; APA, 2020). This is the case for many
types of numbers commonly used by ATLAS including correlations, proportions,
probabilities, and p-values. The fmt_corr()
function is used to format
values bounded between [-1, 1]. Digits are first rounded to the specified
number of digits using fmt_digits()
, and then leading zeros are removed
using fmt_leading_zero()
and negative signs are replaced with
fmt_minus()
. The fmt_prop
is very similar, but is intended for values
between [0, 1]. This function also wraps fmt_digits()
and
fmt_leading_zero()
. However, fmt_prop()
also replaces small values to
avoid values of 0
(e.g., .00
is replaced with < .01
).
The updated character object of the same size as x
.
American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.). doi:10.1037/0000165-000
Other formatters:
fmt_table()
,
padding
test_cor <- cor(mtcars[, 1:4]) as.character(round(test_cor[1:4, 3], 2)) fmt_digits(test_cor[1:4, 3], 2) fmt_digits(test_cor[1:4, 3], 2) %>% fmt_leading_zero() fmt_digits(test_cor[1:4, 3], 2) %>% fmt_minus() fmt_digits(c(test_cor[1:4, 3], NA_real_), 2) %>% fmt_replace_na(replacement = "—") fmt_corr(test_cor[1:4, 3], 2) fmt_prop(c(0.001, 0.035, 0.683), digits = 2)
test_cor <- cor(mtcars[, 1:4]) as.character(round(test_cor[1:4, 3], 2)) fmt_digits(test_cor[1:4, 3], 2) fmt_digits(test_cor[1:4, 3], 2) %>% fmt_leading_zero() fmt_digits(test_cor[1:4, 3], 2) %>% fmt_minus() fmt_digits(c(test_cor[1:4, 3], NA_real_), 2) %>% fmt_replace_na(replacement = "—") fmt_corr(test_cor[1:4, 3], 2) fmt_prop(c(0.001, 0.035, 0.683), digits = 2)
This is a wrapper around ggplot2::ggsave()
with some ATLAS-specific
defaults. The aspect ratio is fixed to 0.618 (the golden ratio) unless the height is
manually defined. Plots are automatically spell checked and warnings are
returned if there are possible mistakes. Finally, plots saved as a pdf have
the fonts embedded using extrafont::embed_fonts()
.
ggsave2( plot = ggplot2::last_plot(), filename, device = NULL, path = NULL, width = 7, height = NULL, units = "in", dir = c("h", "v"), dpi = "retina", embed_fonts = FALSE, ... )
ggsave2( plot = ggplot2::last_plot(), filename, device = NULL, path = NULL, width = 7, height = NULL, units = "in", dir = c("h", "v"), dpi = "retina", embed_fonts = FALSE, ... )
plot |
Plot to save, defaults to last plot displayed. |
filename |
File name to create on disk. |
device |
Device to use. Can either be a device function
(e.g. png), or one of "eps", "ps", "tex" (pictex),
"pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only). If
|
path |
Path of the directory to save plot to: |
width |
Plot size in |
height |
Plot size in |
units |
Units of plot size ("in", "cm", or "mm"). Default is inches. |
dir |
Orientation of the plot. One of |
dpi |
Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types. |
embed_fonts |
Logical. Use Ghostscript to embed fonts in a PDF graphic? |
... |
Additional arguments passed to |
None. Called for side effects.
library(ggplot2) p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() ggsave2(p, "/mtcars.pdf", path = tempdir()) ggsave2(p, "/mtcars.png", path = tempdir())
library(ggplot2) p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() ggsave2(p, "/mtcars.pdf", path = tempdir()) ggsave2(p, "/mtcars.png", path = tempdir())
Generate a section for the yaml input
inc(input, sep = "\n\n ")
inc(input, sep = "\n\n ")
input |
a file containing markdown text |
sep |
a separator for each line. |
a string
## Not run: inc("front-matter/preface.Rmd") ## End(Not run)
## Not run: inc("front-matter/preface.Rmd") ## End(Not run)
This is a function called in the output of the yaml of the Rmd file to specify using the standard measr report document formatting.
measr_pdf(...)
measr_pdf(...)
... |
Arguments to be passed to |
A modified pdf_document2
with the standard tech report formatting.
## Not run: output: ratlas::measr_pdf ## End(Not run)
## Not run: output: ratlas::measr_pdf ## End(Not run)
Adverb for conditionally skipping steps in a piped workflow.
only_if(condition)
only_if(condition)
condition |
Logical condition to be evaluated |
None. Called for side effects.
David Robinson, https://twitter.com/drob/status/785880369073500161
d <- tibble::as_tibble(mtcars) d %>% only_if(TRUE)(dplyr::filter)(mpg > 25) d %>% only_if(FALSE)(dplyr::filter)(mpg > 25)
d <- tibble::as_tibble(mtcars) d %>% only_if(TRUE)(dplyr::filter)(mpg > 25) d %>% only_if(FALSE)(dplyr::filter)(mpg > 25)
A family of functions for formatting numbers and then padding with spaces so that table columns can be both centered and decimal aligned.
pad_counts(x, digits = 0L) pad_prop(x, digits, fmt_small = TRUE, keep_zero = FALSE, output = NULL) pad_corr(x, digits, output = NULL) pad_decimal( x, digits, fmt_small = FALSE, max_value = NULL, keep_zero = FALSE, output = NULL )
pad_counts(x, digits = 0L) pad_prop(x, digits, fmt_small = TRUE, keep_zero = FALSE, output = NULL) pad_corr(x, digits, output = NULL) pad_decimal( x, digits, fmt_small = FALSE, max_value = NULL, keep_zero = FALSE, output = NULL )
x |
Number or number string to be formatted |
digits |
Number of decimal places to retain |
fmt_small |
Indicator for replacing zero with |
keep_zero |
If |
output |
The output type for the rendered document. One of |
max_value |
If |
pad_counts
should be used to pad integer numbers. This wraps
base::format()
to add a comma separator.
pad_prop
should be used to pad decimal numbers between [0,1]. This wraps
fmt_prop()
to round to a specified number of digits
and optionally
remove the leading zero.
pad_corr
should be used to pad decimal numbers between [-1,1]. This wraps
fmt_corr()
, and is similar to pad_prop
, but accounts for negative numbers
when adding padding.
pad_decimal
should be used to pad decimal number that are not bounded. This
wraps fmt_digits()
to round to a specified number of decimal places.
A character vector of the same length as x
.
Other formatters:
fmt_table()
,
formatting
pad_counts(sample(1:1000, size = 20)) pad_prop(c(0.001, runif(5)), digits = 2) pad_corr(runif(10, -1, 1), digits = 2) pad_decimal(runif(10, 1, 100), digits = 1)
pad_counts(sample(1:1000, size = 20)) pad_prop(c(0.001, runif(5)), digits = 2) pad_corr(runif(10, -1, 1), digits = 2) pad_decimal(runif(10, 1, 100), digits = 1)
Official brand colors for Accessible Teaching, Learning, and Assessment Systems.
palette_atlas palette_atlas_black
palette_atlas palette_atlas_black
An object of class character
of length 6.
An object of class character
of length 6.
A colorblind friendly palette taken from the article What to consider when visualizing data for colorblind readers
palette_lcrost palette_lcrost_black
palette_lcrost palette_lcrost_black
An object of class character
of length 8.
An object of class character
of length 8.
Two color palettes taken from the article "Color Universal Design" by Okabe
palette_okabeito
contains a gray color, while palette_okabeito_black
contains black instead.
palette_okabeito palette_okabeito_black
palette_okabeito palette_okabeito_black
An object of class character
of length 8.
An object of class character
of length 8.
Capitalize the first letters of words in a string. Can either use sentence
case (i.e., only the first word capitalized; all = FALSE
) or title case
(i.e., all words capitalized; all = TRUE
).
rat_cap_words(x, all = FALSE)
rat_cap_words(x, all = FALSE)
x |
A character string |
all |
Logical. If |
A character string with the specified capitalization.
name <- c("zip code", "state", "final count") vapply(name, rat_cap_words, character(1)) vapply(name, rat_cap_words, character(1), all = TRUE)
name <- c("zip code", "state", "final count") vapply(name, rat_cap_words, character(1)) vapply(name, rat_cap_words, character(1), all = TRUE)
This is a qualitative scale using the official ATLAS brand colors. See palette_atlas for details.
... |
common discrete scale parameters: |
use_black |
If |
order |
Numeric vector listing the order in which the colors should be used. Default is 1:8. |
darken |
Relative amount by which the scale should be darkened (for positive values) or lightened (for negative values). |
alpha |
Alpha transparency level of the color. Default is no transparency. |
A color scale for use in plots created with ggplot2::ggplot()
.
library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_atlas() ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_density(alpha = 0.7) + scale_fill_atlas(order = c(1, 3, 5))
library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_atlas() ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_density(alpha = 0.7) + scale_fill_atlas(order = c(1, 3, 5))
This is a color-blind friendly, qualitative scale with eight different colors. See palette_lcrost for details. The palette was first described in this blog post.
... |
common discrete scale parameters: |
use_black |
If |
order |
Numeric vector listing the order in which the colors should be used. Default is 1:8. |
darken |
Relative amount by which the scale should be darkened (for positive values) or lightened (for negative values). |
alpha |
Alpha transparency level of the color. Default is no transparency. |
A color scale for use in plots created with ggplot2::ggplot()
.
library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_lcrost() ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_density(alpha = 0.7) + scale_fill_lcrost(order = c(1, 3, 5))
library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_lcrost() ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_density(alpha = 0.7) + scale_fill_lcrost(order = c(1, 3, 5))
This is a color-blind friendly, qualitative scale with eight different colors. See palette_okabeito for details.
... |
common discrete scale parameters: |
use_black |
If |
order |
Numeric vector listing the order in which the colors should be used. Default is 1:8. |
darken |
Relative amount by which the scale should be darkened (for positive values) or lightened (for negative values). |
alpha |
Alpha transparency level of the color. Default is no transparency. |
A color scale for use in plots created with ggplot2::ggplot()
.
library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_okabeito() ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_density(alpha = 0.7) + scale_fill_okabeito(order = c(1, 3, 5))
library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_okabeito() ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_density(alpha = 0.7) + scale_fill_okabeito(order = c(1, 3, 5))
Sets the default color schemes, fonts, and theme for ggplot2 plots. The default color scheme for continuous variables is the viridis color palette, and the default color scheme for discrete variables is the Okabe Ito palette.
set_theme( font = "Arial Narrow", discrete = c("okabeito", "atlas", "ggplot2"), continuous = c("viridis", "magma", "inferno", "plasma", "cividis", "ggplot2"), ... )
set_theme( font = "Arial Narrow", discrete = c("okabeito", "atlas", "ggplot2"), continuous = c("viridis", "magma", "inferno", "plasma", "cividis", "ggplot2"), ... )
font |
The base font family to be used in plots. |
discrete |
Color palette for discrete colors. One of "okabeito" (default), "atlas", or "ggplot2". |
continuous |
Color palette for continuous scales. One of "magma", "inferno", "plasma", "viridis" (default), or "cividis", or "ggplot2". |
... |
Additional arguments to pass to theme functions. |
None. Called for side effects.
set_theme("Arial Narrow")
set_theme("Arial Narrow")
This is a function called in the output of the YAML of the Rmd file to specify using the standard DLM tech report pdf document formatting.
slides_html(...)
slides_html(...)
... |
Arguments to be passed to |
A modified mood_reader
with ATLAS branding applied.
## Not run: output: ratlas::slides_html ## End(Not run)
## Not run: output: ratlas::slides_html ## End(Not run)
This is a function called in the output of the yaml of the Rmd file to specify using the standard DLM tech report pdf document formatting.
techreport_gitbook(...)
techreport_gitbook(...)
... |
Arguments to be passed to |
A modified gitbook
with the standard tech report formatting.
## Not run: output: ratlas::techreport_gitbook ## End(Not run)
## Not run: output: ratlas::techreport_gitbook ## End(Not run)
This is a function called in the output of the yaml of the Rmd file to specify using the standard DLM tech report pdf document formatting.
techreport_pdf(apa6 = FALSE, ...)
techreport_pdf(apa6 = FALSE, ...)
apa6 |
Should the old |
... |
Arguments to be passed to |
A modified pdf_document2
with the standard tech report formatting.
## Not run: output: ratlas::techreport_pdf ## End(Not run)
## Not run: output: ratlas::techreport_pdf ## End(Not run)
Based on hrbrthemes::theme_ipsum
.
theme_atlas( base_family = "Arial Narrow", base_size = 11.5, plot_title_family = base_family, plot_title_size = 18, plot_title_face = "bold", plot_title_margin = 10, subtitle_family = base_family, subtitle_size = 12, subtitle_face = "plain", subtitle_margin = 15, strip_text_family = base_family, strip_text_size = 12, strip_text_face = "plain", caption_family = base_family, caption_size = 9, caption_face = "italic", caption_margin = 10, axis_text_size = 9, axis_title_family = subtitle_family, axis_title_size = base_size, axis_title_face = "plain", axis_title_just = "cm", plot_margin = ggplot2::margin(30, 30, 30, 30), grid_col = "#cccccc", grid = TRUE, axis_col = "#cccccc", axis = FALSE, ticks = FALSE )
theme_atlas( base_family = "Arial Narrow", base_size = 11.5, plot_title_family = base_family, plot_title_size = 18, plot_title_face = "bold", plot_title_margin = 10, subtitle_family = base_family, subtitle_size = 12, subtitle_face = "plain", subtitle_margin = 15, strip_text_family = base_family, strip_text_size = 12, strip_text_face = "plain", caption_family = base_family, caption_size = 9, caption_face = "italic", caption_margin = 10, axis_text_size = 9, axis_title_family = subtitle_family, axis_title_size = base_size, axis_title_face = "plain", axis_title_just = "cm", plot_margin = ggplot2::margin(30, 30, 30, 30), grid_col = "#cccccc", grid = TRUE, axis_col = "#cccccc", axis = FALSE, ticks = FALSE )
base_family , base_size
|
base font family and size |
plot_title_family , plot_title_face , plot_title_size , plot_title_margin
|
plot title family, face, size and margin |
subtitle_family , subtitle_face , subtitle_size
|
plot subtitle family, face and size |
subtitle_margin |
plot subtitle margin bottom (single numeric value) |
strip_text_family , strip_text_face , strip_text_size
|
facet label font family, face and size |
caption_family , caption_face , caption_size , caption_margin
|
plot caption family, face, size and margin |
axis_text_size |
font size of axis text |
axis_title_family , axis_title_face , axis_title_size
|
axis title font family, face and size |
axis_title_just |
axis title font justification, one of |
plot_margin |
plot margin (specify with |
grid_col , axis_col
|
grid & axis colors; both default to |
grid |
panel grid ( |
axis |
add x or y axes? |
ticks |
ticks if |
A theme for use in plots created with ggplot2::ggplot()
.
## Not run: library(ggplot2) library(dplyr) # seminal scatterplot ggplot(mtcars, aes(mpg, wt)) + geom_point() + labs(x = "Fuel effiiency (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'") + theme_atlas() # seminal bar chart update_geom_font_defaults() count(mpg, class) %>% ggplot(aes(class, n)) + geom_col() + geom_text(aes(label=n), nudge_y=3) + labs(x = "Fuel efficiency (mpg)", y = "Weight (tons)", title = "Seminal ggplot2 bar chart example", subtitle = "A plot that is only useful for demonstration purposes", caption = "Brought to you by the letter 'g'") + theme_atlas(grid = "Y") + theme(axis.text.y = element_blank()) ## End(Not run)
## Not run: library(ggplot2) library(dplyr) # seminal scatterplot ggplot(mtcars, aes(mpg, wt)) + geom_point() + labs(x = "Fuel effiiency (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'") + theme_atlas() # seminal bar chart update_geom_font_defaults() count(mpg, class) %>% ggplot(aes(class, n)) + geom_col() + geom_text(aes(label=n), nudge_y=3) + labs(x = "Fuel efficiency (mpg)", y = "Weight (tons)", title = "Seminal ggplot2 bar chart example", subtitle = "A plot that is only useful for demonstration purposes", caption = "Brought to you by the letter 'g'") + theme_atlas(grid = "Y") + theme(axis.text.y = element_blank()) ## End(Not run)
This is a function called in the output of the yaml of the Rmd file to specify using the standard DLM topic guide word document formatting.
topicguide_docx(...)
topicguide_docx(...)
... |
Arguments to be passed to |
A modified word_document2
with the standard topic guide formatting.
## Not run: output: ratlas::topicguide_docx ## End(Not run)
## Not run: output: ratlas::topicguide_docx ## End(Not run)
This is a function called in the output of the yaml of the Rmd file to specify using the standard DLM topic guide document formatting.
topicguide_pdf(...)
topicguide_pdf(...)
... |
Arguments to be passed to |
A modified pdf_document2
with the standard tech report formatting.
## Not run: output: ratlas::topicguide_pdf ## End(Not run)
## Not run: output: ratlas::topicguide_pdf ## End(Not run)
This is a function called in the output of the yaml of the Rmd file to specify using the standard DLM topic guide word document formatting.
topicguide_rdocx(...)
topicguide_rdocx(...)
... |
Arguments to be passed to |
A modified word_document2
with the standard topic guide formatting.
## Not run: output: ratlas::topicguide_rdocx ## End(Not run)
## Not run: output: ratlas::topicguide_rdocx ## End(Not run)
Updates ggplot2::geom_label and ggplot2::geom_text font defaults
update_geom_font_defaults( family = "Arial Narrow", face = "plain", size = 3.5, color = "#2b2b2b" )
update_geom_font_defaults( family = "Arial Narrow", face = "plain", size = 3.5, color = "#2b2b2b" )
family , face , size , color
|
font family name, face, size and color |
None. Called for side effects.
# updates font to Arial Narrow, size to 3.5, and color to #2b2b2b by default update_geom_font_defaults()
# updates font to Arial Narrow, size to 3.5, and color to #2b2b2b by default update_geom_font_defaults()