Package 'plummy'

Title: Themes for ggplot2
Description: Custom ggplot2 themes with custom fonts.
Authors: Roy Francis [aut, cre] (ORCID: <https://orcid.org/0000-0001-8654-3580>)
Maintainer: Roy Francis <[email protected]>
License: MIT + file LICENSE
Version: 0.3
Built: 2026-06-05 06:49:56 UTC
Source: https://github.com/royfrancis/plummy

Help Index


Import font for use in ggplot2 graphs

Description

Import font for use in ggplot2 graphs

Usage

import_barlow()

import_inter()

import_lato()

import_nunito()

import_plex()

List all fonts

Description

Lists all fonts and families.

Usage

list_fonts()

Value

Returns a data.frame with name, family, font, weight and path. The name is used as 'family' when plotting.


10 color qualitative color palette from morris

Description

10 color qualitative color palette from morris

Usage

palette_morris()

Examples

library(scales)
scales::show_col(palette_morris()(10))

8 color qualitative color palette from okabeito

Description

8 color qualitative color palette from okabeito

Usage

palette_okabeito()

Examples

library(scales)
scales::show_col(palette_okabeito()(8))

17 color qualitative color palette from strong

Description

17 color qualitative color palette from strong

Usage

palette_strong()

Examples

library(scales)
scales::show_col(palette_strong()(17))

20 color qualitative color palette from tableau

Description

20 color qualitative color palette from tableau

Usage

palette_tableau()

Examples

library(scales)
scales::show_col(palette_tableau()(20))

Custom ggplot2 theme

Description

Custom ggplot2 theme

Usage

plummy(style = "grid", family = "", ...)

Arguments

style

A theme style. Options are 'grid'.

family

A font family name. Options are 'barlow', 'inter', 'lato', 'nunito' and 'plex'.

...

Arguments passed to low level theme functions theme_style*_font*()


Discrete color & fill scales based on the morris palette

Description

See palette_morris().

Usage

scale_colour_morris(...)

scale_color_morris(...)

scale_fill_morris(...)

Arguments

...

Arguments passed on to ggplot2::discrete_scale

aesthetics

The names of the aesthetics that this scale works with.

scale_name

[Deprecated] The name of the scale that should be used for error messages associated with this scale.

palette

A palette function that when called with a single integer argument (the number of levels in the scale) returns the values that they should take (e.g., scales::pal_hue()).

name

The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.

breaks

One of:

  • NULL for no breaks

  • waiver() for the default breaks (the scale limits)

  • A character vector of breaks

  • A function that takes the limits as input and returns breaks as output. Also accepts rlang lambda function notation.

minor_breaks

One of:

  • NULL for no minor breaks

  • waiver() for the default breaks (none for discrete, one minor break between each major break for continuous)

  • A numeric vector of positions

  • A function that given the limits returns a vector of minor breaks. Also accepts rlang lambda function notation. When the function has two arguments, it will be given the limits and major break positions.

labels

One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches.

  • NULL for no labels

  • waiver() for the default labels computed by the transformation object

  • A character vector giving labels (must be same length as breaks)

  • An expression vector (must be the same length as breaks). See ?plotmath for details.

  • A function that takes the breaks as input and returns labels as output. Also accepts rlang lambda function notation.

limits

One of:

  • NULL to use the default scale values

  • A character vector that defines possible values of the scale and their order

  • A function that accepts the existing (automatic) values and returns new ones. Also accepts rlang lambda function notation.

na.translate

Unlike continuous scales, discrete scales can easily show missing values, and do so by default. If you want to remove missing values from a discrete scale, specify na.translate = FALSE.

na.value

If na.translate = TRUE, what aesthetic value should the missing values be displayed as? Does not apply to position scales where NA is always placed at the far right.

drop

Should unused factor levels be omitted from the scale? The default, TRUE, uses the levels that appear in the data; FALSE includes the levels in the factor. Please note that to display every level in a legend, the layer should use show.legend = TRUE.

guide

A function used to create a guide or its name. See guides() for more information.

fallback.palette

Function to use when palette = NULL and the palette is not represented in the theme.

call

The call used to construct the scale for reporting messages.

super

The super class to use for the constructed scale


Discrete color & fill scales based on the okabeito palette

Description

See palette_okabeito().

Usage

scale_colour_okabeito(...)

scale_color_okabeito(...)

scale_fill_okabeito(...)

Arguments

...

Arguments passed on to ggplot2::discrete_scale

aesthetics

The names of the aesthetics that this scale works with.

scale_name

[Deprecated] The name of the scale that should be used for error messages associated with this scale.

palette

A palette function that when called with a single integer argument (the number of levels in the scale) returns the values that they should take (e.g., scales::pal_hue()).

name

The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.

breaks

One of:

  • NULL for no breaks

  • waiver() for the default breaks (the scale limits)

  • A character vector of breaks

  • A function that takes the limits as input and returns breaks as output. Also accepts rlang lambda function notation.

minor_breaks

One of:

  • NULL for no minor breaks

  • waiver() for the default breaks (none for discrete, one minor break between each major break for continuous)

  • A numeric vector of positions

  • A function that given the limits returns a vector of minor breaks. Also accepts rlang lambda function notation. When the function has two arguments, it will be given the limits and major break positions.

labels

One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches.

  • NULL for no labels

  • waiver() for the default labels computed by the transformation object

  • A character vector giving labels (must be same length as breaks)

  • An expression vector (must be the same length as breaks). See ?plotmath for details.

  • A function that takes the breaks as input and returns labels as output. Also accepts rlang lambda function notation.

limits

One of:

  • NULL to use the default scale values

  • A character vector that defines possible values of the scale and their order

  • A function that accepts the existing (automatic) values and returns new ones. Also accepts rlang lambda function notation.

na.translate

Unlike continuous scales, discrete scales can easily show missing values, and do so by default. If you want to remove missing values from a discrete scale, specify na.translate = FALSE.

na.value

If na.translate = TRUE, what aesthetic value should the missing values be displayed as? Does not apply to position scales where NA is always placed at the far right.

drop

Should unused factor levels be omitted from the scale? The default, TRUE, uses the levels that appear in the data; FALSE includes the levels in the factor. Please note that to display every level in a legend, the layer should use show.legend = TRUE.

guide

A function used to create a guide or its name. See guides() for more information.

fallback.palette

Function to use when palette = NULL and the palette is not represented in the theme.

call

The call used to construct the scale for reporting messages.

super

The super class to use for the constructed scale


Discrete color & fill scales based on the strong palette

Description

See palette_strong().

Usage

scale_colour_strong(...)

scale_color_strong(...)

scale_fill_strong(...)

Arguments

...

Arguments passed on to ggplot2::discrete_scale

aesthetics

The names of the aesthetics that this scale works with.

scale_name

[Deprecated] The name of the scale that should be used for error messages associated with this scale.

palette

A palette function that when called with a single integer argument (the number of levels in the scale) returns the values that they should take (e.g., scales::pal_hue()).

name

The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.

breaks

One of:

  • NULL for no breaks

  • waiver() for the default breaks (the scale limits)

  • A character vector of breaks

  • A function that takes the limits as input and returns breaks as output. Also accepts rlang lambda function notation.

minor_breaks

One of:

  • NULL for no minor breaks

  • waiver() for the default breaks (none for discrete, one minor break between each major break for continuous)

  • A numeric vector of positions

  • A function that given the limits returns a vector of minor breaks. Also accepts rlang lambda function notation. When the function has two arguments, it will be given the limits and major break positions.

labels

One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches.

  • NULL for no labels

  • waiver() for the default labels computed by the transformation object

  • A character vector giving labels (must be same length as breaks)

  • An expression vector (must be the same length as breaks). See ?plotmath for details.

  • A function that takes the breaks as input and returns labels as output. Also accepts rlang lambda function notation.

limits

One of:

  • NULL to use the default scale values

  • A character vector that defines possible values of the scale and their order

  • A function that accepts the existing (automatic) values and returns new ones. Also accepts rlang lambda function notation.

na.translate

Unlike continuous scales, discrete scales can easily show missing values, and do so by default. If you want to remove missing values from a discrete scale, specify na.translate = FALSE.

na.value

If na.translate = TRUE, what aesthetic value should the missing values be displayed as? Does not apply to position scales where NA is always placed at the far right.

drop

Should unused factor levels be omitted from the scale? The default, TRUE, uses the levels that appear in the data; FALSE includes the levels in the factor. Please note that to display every level in a legend, the layer should use show.legend = TRUE.

guide

A function used to create a guide or its name. See guides() for more information.

fallback.palette

Function to use when palette = NULL and the palette is not represented in the theme.

call

The call used to construct the scale for reporting messages.

super

The super class to use for the constructed scale


Discrete color & fill scales based on the tableau palette

Description

See palette_tableau().

Usage

scale_colour_tableau(...)

scale_color_tableau(...)

scale_fill_tableau(...)

Arguments

...

Arguments passed on to ggplot2::discrete_scale

aesthetics

The names of the aesthetics that this scale works with.

scale_name

[Deprecated] The name of the scale that should be used for error messages associated with this scale.

palette

A palette function that when called with a single integer argument (the number of levels in the scale) returns the values that they should take (e.g., scales::pal_hue()).

name

The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.

breaks

One of:

  • NULL for no breaks

  • waiver() for the default breaks (the scale limits)

  • A character vector of breaks

  • A function that takes the limits as input and returns breaks as output. Also accepts rlang lambda function notation.

minor_breaks

One of:

  • NULL for no minor breaks

  • waiver() for the default breaks (none for discrete, one minor break between each major break for continuous)

  • A numeric vector of positions

  • A function that given the limits returns a vector of minor breaks. Also accepts rlang lambda function notation. When the function has two arguments, it will be given the limits and major break positions.

labels

One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches.

  • NULL for no labels

  • waiver() for the default labels computed by the transformation object

  • A character vector giving labels (must be same length as breaks)

  • An expression vector (must be the same length as breaks). See ?plotmath for details.

  • A function that takes the breaks as input and returns labels as output. Also accepts rlang lambda function notation.

limits

One of:

  • NULL to use the default scale values

  • A character vector that defines possible values of the scale and their order

  • A function that accepts the existing (automatic) values and returns new ones. Also accepts rlang lambda function notation.

na.translate

Unlike continuous scales, discrete scales can easily show missing values, and do so by default. If you want to remove missing values from a discrete scale, specify na.translate = FALSE.

na.value

If na.translate = TRUE, what aesthetic value should the missing values be displayed as? Does not apply to position scales where NA is always placed at the far right.

drop

Should unused factor levels be omitted from the scale? The default, TRUE, uses the levels that appear in the data; FALSE includes the levels in the factor. Please note that to display every level in a legend, the layer should use show.legend = TRUE.

guide

A function used to create a guide or its name. See guides() for more information.

fallback.palette

Function to use when palette = NULL and the palette is not represented in the theme.

call

The call used to construct the scale for reporting messages.

super

The super class to use for the constructed scale


ggplot2 grid theme.

Description

ggplot2 grid theme.

Usage

theme_grid_barlow(...)

theme_grid(
  base_family = "",
  base_size = 10.5,
  scaling = 1.2,
  title_family = "",
  title_size = base_size * scaling^2,
  title_face = "bold",
  title_color = "#2e4053",
  title_margin = margin(b = 2),
  subtitle_family = "",
  subtitle_size = base_size * scaling,
  subtitle_face = "plain",
  subtitle_color = "#2e4053",
  subtitle_margin = margin(b = 6),
  strip_text_family = "",
  strip_text_size = base_size,
  strip_text_face = "bold",
  strip_text_color = "#2e4053",
  caption_family = "",
  caption_size = base_size/scaling,
  caption_face = "plain",
  caption_color = "#aeb6bf",
  caption_margin = margin(t = 10),
  axis_text_family = "",
  axis_text_face = "plain",
  axis_text_color = "#2e4053",
  axis_text_size = base_size/scaling,
  axis_title_family = "",
  axis_title_size = base_size/scaling,
  axis_title_face = "plain",
  axis_title_color = "#2e4053",
  axis_title_just = "rt",
  plot_margin = margin(20, 20, 20, 20),
  plot_title_position = "plot",
  plot_caption_position = "plot",
  grid_color = "#cccccc",
  grid = TRUE,
  axis_color = "#cccccc",
  axis = TRUE,
  ticks = FALSE,
  tsc_just = 0,
  leg = "v",
  leg_just = "center",
  base_theme = theme_minimal
)

theme_grid_inter(...)

theme_grid_lato(...)

theme_grid_nunito(...)

theme_grid_plex(...)

Arguments

...

Arguments passed to plummy::theme_grid()

base_family, base_size

Base: font family and size

scaling

Font size scaling factor

title_family, title_face, title_color, title_size, title_margin

Plot title: font family, face, color, size and margin

subtitle_family, subtitle_face, subtitle_color, subtitle_size, subtitle_margin

Plot subtitle: font family, face, color, size and margin

strip_text_family, strip_text_face, strip_text_color, strip_text_size

Facet label: font family, face, color and size

caption_family, caption_face, caption_color, caption_size, caption_margin

Plot caption: font family, face, color, size and margin

axis_text_family, axis_text_face, axis_text_color

Axis text: font family, face and color

axis_text_size

Font size of axis text

axis_title_family, axis_title_face, axis_title_color, axis_title_size

Axis title: font family, face, color and size

axis_title_just

Axis title font justification, one of ⁠[blmcrt]⁠ denoting bottom, left, middle, center, right and top.

plot_margin

Plot margin

plot_title_position

Position of title/subtitle relative to panel ("panel") or full plot ("plot").

plot_caption_position

Position of caption relative to panel ("panel") or full plot ("plot").

grid_color

Grid color

grid

Panel grid (TRUE, FALSE, or a combination of X, x, Y, y denoting major and minor gridlines)

axis_color

Axis color

axis

Add x or y axes? TRUE, FALSE, "xy". Includes axis title and axis text.

ticks

Adds ticks if TRUE

tsc_just

Horizontal justification for title, subtitle, caption.

leg

Legend position. "v" for regular vertical on the right. "h" for horizontal on top.

leg_just

Legend justification

base_theme

Base theme. Defaults to theme_minimal().

Details

Specify margins using ggplot2::margin()


Update font for geom

Description

Update font family for geom_text and geom_label Note that this changes the default geom family for the whole session

Usage

update_geom_font(family = "")

Arguments

family

A valid font family name