The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Package {ggblanket}


Title: Publication-Quality 'ggplot2' Visualisation
Version: 20.0.0
Description: Wrapper 'ggplot2' functions for publication-quality visualisation. Aligned with 'ggplot2' and 'tidyverse'. Covers much of what 'ggplot2' does.
License: MIT + file LICENSE
URL: https://davidhodge931.github.io/ggblanket/, https://github.com/davidhodge931/ggblanket
BugReports: https://github.com/davidhodge931/ggblanket/issues
Depends: R (≥ 4.2.0)
Imports: blends, farver, ggnewscale (≥ 0.5.2), ggplot2 (≥ 4.0.0), ggrefine, jumble, purrr, rlang, scales (≥ 1.4.0), snakecase, stringr, viridis
Suggests: dplyr, flexoki, forcats, hexbin, knitr, lubridate, palmerpenguins, patchwork, quantreg, rmarkdown, sf, spelling, testthat (≥ 3.0.0), tibble, tidyr, vdiffr
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-GB
RoxygenNote: 7.3.3
NeedsCompilation: no
Packaged: 2026-05-07 05:46:29 UTC; david
Author: David Hodge ORCID iD [aut, cre, cph]
Maintainer: David Hodge <davidhodge931@gmail.com>
Repository: CRAN
Date/Publication: 2026-05-07 06:10:13 UTC

ggblanket: Publication-Quality 'ggplot2' Visualisation

Description

logo

Wrapper 'ggplot2' functions for publication-quality visualisation. Aligned with 'ggplot2' and 'tidyverse'. Covers much of what 'ggplot2' does.

Author(s)

Maintainer: David Hodge davidhodge931@gmail.com (ORCID) [copyright holder]

See Also

Useful links:


Area ggplot

Description

An area ggplot with geom_area() defaults for the geom, stat and position.

Usage

gg_area(
  data,
  ...,
  geom = "area",
  stat = "align",
  position = ggplot2::position_stack(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::economics |>
  gg_area(
    x = date,
    y = unemploy,
  )

ggplot2::economics_long |>
  gg_area(
    x = date,
    y = value01,
    fill = variable,
  )

ggplot2::economics_long |>
  gg_area(
    x = date,
    y = value01,
    facet_wrap = variable,
  )


Bar ggplot

Description

A bar ggplot with geom_bar() defaults for the geom, stat and position.

Usage

gg_bar(
  data,
  ...,
  geom = "bar",
  stat = "count",
  position = ggplot2::position_stack(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::diamonds |>
  gg_bar(
    x = color,
  )

ggplot2::diamonds |>
  gg_bar(
    x = color,
    fill = cut,
    position = ggplot2::position_dodge(),
  )

ggplot2::diamonds |>
  dplyr::filter(cut %in% c("Premium", "Ideal")) |>
  gg_bar(
    x = color,
    facet_wrap = cut,
  )


Bin2d ggplot

Description

A bin2d ggplot with geom_bin2d() defaults for the geom, stat and position.

Note gg_bin2d defaults to colour = NA.

Usage

gg_bin2d(
  data,
  ...,
  geom = "bin2d",
  stat = "bin2d",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = ggplot2::after_stat(.data$count),
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::diamonds |>
  gg_bin2d(
    x = carat,
    y = price,
  )

ggplot2::diamonds |>
  gg_bin2d(
    x = carat,
    y = price,
    facet_wrap = cut,
  )


Any ggplot

Description

A blank ggplot with geom_blank() defaults for the geom, stat and position.

Note this is an all-purpose custom wrapper intended for use with any geom.

Usage

gg_blanket(
  data,
  ...,
  geom = "blank",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = NULL,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

gg_blanket(
  data = mtcars,
  geom = "point",
  x = wt,
  y = mpg,
  fill = hp,
)

gg_blanket(
  data = mtcars,
  geom = "point",
  x = wt,
  y = mpg,
  fill = factor(cyl),
  facet_wrap = cyl,
)

Boxplot ggplot

Description

A boxplot ggplot with geom_boxplot() defaults for the geom, stat and position.

Usage

gg_boxplot(
  data,
  ...,
  geom = "boxplot",
  stat = "boxplot",
  position = ggplot2::position_dodge2(preserve = "single"),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::diamonds |>
  gg_boxplot(
    x = color,
    y = carat,
    y_limits = c(0, NA),
  )

ggplot2::diamonds |>
  gg_boxplot(
    x = color,
    y = carat,
    fill = cut,
    y_limits = c(0, NA),
  )

ggplot2::diamonds |>
  dplyr::filter(cut %in% c("Premium", "Ideal")) |>
  gg_boxplot(
    x = color,
    y = carat,
    facet_wrap = ggplot2::vars(cut),
    y_limits = c(0, NA),
  )


Col ggplot

Description

A col ggplot with geom_col() defaults for the geom, stat and position.

Usage

gg_col(
  data,
  ...,
  geom = "col",
  stat = "identity",
  position = ggplot2::position_stack(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::diamonds |>
  dplyr::count(color) |>
  gg_col(
    x = color,
    y = n,
  )

ggplot2::diamonds |>
  dplyr::count(color, cut) |>
  gg_col(
    x = color,
    y = n,
    fill = cut,
    position = ggplot2::position_dodge(),
  )

ggplot2::diamonds |>
  dplyr::filter(cut %in% c("Premium", "Ideal")) |>
  dplyr::count(color, cut) |>
  gg_col(
    x = color,
    y = n,
    facet_wrap = cut,
  )


Contour ggplot

Description

A contour ggplot with geom_contour() defaults for the geom, stat and position.

Usage

gg_contour(
  data,
  ...,
  geom = "contour",
  stat = "contour",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::faithfuld |>
  gg_contour(
    x = waiting,
    y = eruptions,
    z = density,
  )


Contour filled ggplot

Description

A contour filled ggplot with geom_contour_filled() defaults for the geom, stat and position.

Note gg_contour_filled defaults to colour = NA.

Usage

gg_contour_filled(
  data,
  ...,
  geom = "contour_filled",
  stat = "contour_filled",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = ggplot2::after_stat(.data$level),
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::faithfuld |>
  gg_contour_filled(
    x = waiting,
    y = eruptions,
    z = density,
    fill_palette = scales::pal_viridis(option = "turbo"),
  )


Crossbar ggplot

Description

A crossbar ggplot with geom_crossbar() defaults for the geom, stat and position.

Usage

gg_crossbar(
  data,
  ...,
  geom = "crossbar",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  dplyr::group_by(Species) |>
  dplyr::summarise(
    mean = mean(Sepal.Length),
    lower = mean(Sepal.Length) - sd(Sepal.Length),
    upper = mean(Sepal.Length) + sd(Sepal.Length),
  ) |>
  gg_crossbar(
    x = Species,
    y = mean,
    ymin = lower,
    ymax = upper,
  )

ggplot2::mpg |>
  dplyr::group_by(class, drv) |>
  dplyr::summarise(
    mean_hwy = mean(hwy),
    lower = mean_hwy - sd(hwy),
    upper = mean_hwy + sd(hwy),
  ) |>
  gg_crossbar(
    x = class,
    y = mean_hwy,
    ymin = lower,
    ymax = upper,
    fill = drv,
    position = ggplot2::position_dodge2(preserve = "single"),
  )

ggplot2::mpg |>
  dplyr::group_by(class, drv) |>
  dplyr::summarise(
    mean_hwy = mean(hwy),
    lower = mean_hwy - sd(hwy),
    upper = mean_hwy + sd(hwy),
  ) |>
  gg_crossbar(
    x = drv,
    y = mean_hwy,
    ymin = lower,
    ymax = upper,
    facet_wrap = class,
  )


Density ggplot

Description

A density ggplot with geom_density() defaults for the geom, stat and position.

Usage

gg_density(
  data,
  ...,
  geom = "density",
  stat = "density",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  gg_density(
    x = Sepal.Width,
  )

iris |>
  gg_density(
    x = Sepal.Width,
    fill = Species,
  )

iris |>
  gg_density(
    x = Sepal.Width,
    facet_wrap = Species,
  )


Density 2d ggplot

Description

A density 2d ggplot with geom_density_2d() defaults for the geom, stat and position.

Usage

gg_density2d(
  data,
  ...,
  geom = "density2d",
  stat = "density2d",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  gg_density2d(
    x = Sepal.Width,
    y = Sepal.Length,
  )

iris |>
  gg_density2d(
    x = Sepal.Width,
    y = Sepal.Length,
    fill = Species,
  )


Density 2d filled ggplot

Description

A density 2d filled ggplot with geom_density_2d_filled() defaults for the geom, stat and position.

Note gg_density2d_filled defaults to colour = NA.

Usage

gg_density2d_filled(
  data,
  ...,
  geom = "density2d_filled",
  stat = "density2d_filled",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = ggplot2::after_stat(.data$level),
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  gg_density2d_filled(
    x = Sepal.Width,
    y = Sepal.Length,
    fill_palette = scales::pal_viridis(option = "turbo"),
  )

iris |>
  gg_density2d_filled(
    x = Sepal.Width,
    y = Sepal.Length,
    facet_wrap = Species,
    fill_palette = scales::pal_viridis(option = "turbo"),
  )


Errorbar ggplot

Description

An errorbar ggplot with geom_errorbar() defaults for the geom, stat and position.

Usage

gg_errorbar(
  data,
  ...,
  geom = "errorbar",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  dplyr::group_by(Species) |>
  dplyr::summarise(
    mean = mean(Sepal.Length),
    lower = mean(Sepal.Length) - sd(Sepal.Length),
    upper = mean(Sepal.Length) + sd(Sepal.Length),
  ) |>
  gg_errorbar(
    x = Species,
    y = mean,
    ymin = lower,
    ymax = upper,
  )

ggplot2::mpg |>
  dplyr::group_by(class, drv) |>
  dplyr::summarise(
    mean_hwy = mean(hwy),
    lower = mean_hwy - sd(hwy),
    upper = mean_hwy + sd(hwy),
  ) |>
  gg_errorbar(
    x = class,
    y = mean_hwy,
    ymin = lower,
    ymax = upper,
    fill = drv,
    position = ggplot2::position_dodge2(preserve = "single"),
  )

ggplot2::mpg |>
  dplyr::group_by(class, drv) |>
  dplyr::summarise(
    mean_hwy = mean(hwy),
    lower = mean_hwy - sd(hwy),
    upper = mean_hwy + sd(hwy),
  ) |>
  gg_errorbar(
    x = drv,
    y = mean_hwy,
    ymin = lower,
    ymax = upper,
    facet_wrap = class,
  )


Freqpoly ggplot

Description

A freqpoly ggplot with geom_freqpoly() defaults for the geom, stat and position.

Usage

gg_freqpoly(
  data,
  ...,
  geom = "freqpoly",
  stat = "bin",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::diamonds |>
  gg_freqpoly(
    x = carat,
  )

ggplot2::diamonds |>
  gg_freqpoly(
    x = carat,
    fill = cut,
  )

ggplot2::diamonds |>
  gg_freqpoly(
    x = carat,
    facet_wrap = cut,
  )


Hex ggplot

Description

A hex ggplot with geom_hex() defaults for the geom, stat and position.

Note gg_hex defaults to colour = NA.

Usage

gg_hex(
  data,
  ...,
  geom = "hex",
  stat = "binhex",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = ggplot2::after_stat(.data$count),
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::diamonds |>
  gg_hex(
    x = carat,
    y = price,
  )

ggplot2::diamonds |>
  gg_hex(
    x = carat,
    y = price,
    facet_wrap = cut,
  )


Histogram ggplot

Description

A histogram ggplot with geom_histogram() defaults for the geom, stat and position.

Usage

gg_histogram(
  data,
  ...,
  geom = "histogram",
  stat = "bin",
  position = ggplot2::position_stack(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  gg_histogram(
    x = Sepal.Width,
  )

iris |>
  gg_histogram(
    x = Sepal.Width,
    fill = Species,
  )

iris |>
  gg_histogram(
    x = Sepal.Width,
    facet_wrap = Species,
  )


Jitter ggplot

Description

A jitter ggplot with geom_jitter() defaults for the geom, stat and position.

Usage

gg_jitter(
  data,
  ...,
  geom = "jitter",
  stat = "identity",
  position = ggplot2::position_jitter(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  gg_jitter(
    x = Sepal.Width,
    y = Sepal.Length,
  )

iris |>
  gg_jitter(
    x = Sepal.Width,
    y = Sepal.Length,
    fill = Species,
  )

iris |>
  gg_jitter(
    x = Sepal.Width,
    y = Sepal.Length,
    facet_wrap = Species,
  )


Line ggplot

Description

A line ggplot with geom_line() defaults for the geom, stat and position.

Usage

gg_line(
  data,
  ...,
  geom = "line",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

library(dplyr)
library(ggplot2)



ggplot2::economics |>
  gg_line(
    x = date,
    y = unemploy,
    y_limits = \(x) range(x, 0),
  )

ggplot2::economics_long |>
  gg_line(
    x = date,
    y = value01,
    fill = variable,
  )

ggplot2::economics_long |>
  gg_line(
    x = date,
    y = value01,
    facet_wrap = variable,
  )

ggplot2::economics_long |>
  group_by(variable) |>
  slice_head(n = 10) |>
  filter(variable != "psavert") |>
  gg_point(
    x = date,
    y = value01,
    fill = variable,
    before = geom_line(),
  )


Linerange ggplot

Description

A linerange ggplot with geom_linerange() defaults for the geom, stat and position.

Usage

gg_linerange(
  data,
  ...,
  geom = "linerange",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

library(ggplot2)

iris |>
  dplyr::group_by(Species) |>
  dplyr::summarise(
    mean = mean(Sepal.Length),
    lower = mean(Sepal.Length) - sd(Sepal.Length),
    upper = mean(Sepal.Length) + sd(Sepal.Length),
  ) |>
  gg_linerange(
    x = Species,
    y = mean,
    ymin = lower,
    ymax = upper,
  )

mpg |>
  dplyr::group_by(class, drv) |>
  dplyr::summarise(
    mean = mean(hwy),
    lower = mean - sd(hwy),
    upper = mean + sd(hwy),
  ) |>
  gg_linerange(
    x = class,
    ymin = lower,
    y = mean,
    ymax = upper,
    fill = drv,
    position = position_dodge2(width = 0.25),
  )

mpg |>
  dplyr::group_by(class, drv) |>
  dplyr::summarise(
    mean = mean(hwy),
    lower = mean - sd(hwy),
    upper = mean + sd(hwy),
  ) |>
  gg_linerange(
    x = drv,
    y = mean,
    ymin = lower,
    ymax = upper,
    facet_wrap = class,
  )

mpg |>
  dplyr::group_by(class, drv) |>
  dplyr::summarise(
    mean = mean(hwy),
    lower = mean - sd(hwy),
    upper = mean + sd(hwy),
  ) |>
  gg_point(
    x = class,
    ymin = lower,
    y = mean,
    ymax = upper,
    fill = drv,
    position = position_dodge2(width = 0.25),
    before = geom_linerange(
      position = position_dodge2(width = 0.25),
    )
  )

penguins |>
  dplyr::count(species, sex) |>
  tidyr::drop_na() |>
  gg_point(
    x = species,
    y = n,
    fill = sex,
    position = position_dodge(width = 0.2),
    before = ggplot2::geom_linerange(
      aes(ymin = 0, ymax = n),
      position = position_dodge(width = 0.2),
    ),
  )

Path ggplot

Description

A path ggplot with geom_path() defaults for the geom, stat and position.

Usage

gg_path(
  data,
  ...,
  geom = "path",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

library(dplyr)
library(ggplot2)

ggplot2::economics |>
  gg_path(
    x = date,
    y = unemploy,
    y_limits = \(x) range(x, 0),
  )

ggplot2::economics_long |>
  gg_path(
    x = date,
    y = value01,
    fill = variable,
  )

ggplot2::economics_long |>
  gg_path(
    x = date,
    y = value01,
    facet_wrap = variable,
  )

ggplot2::economics_long |>
  group_by(variable) |>
  slice_head(n = 10) |>
  filter(variable != "psavert") |>
  gg_point(
    x = date,
    y = value01,
    fill = variable,
    before = geom_path(),
  )


Point ggplot

Description

A point ggplot with geom_point() defaults for the geom, stat and position.

Usage

gg_point(
  data,
  ...,
  geom = "point",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

library(dplyr)
library(ggplot2)

iris |>
  gg_point(
    x = Sepal.Width,
    y = Sepal.Length,
  )

iris |>
  gg_point(
    x = Sepal.Width,
    y = Sepal.Length,
    fill = Species,
  )

iris |>
  gg_point(
    x = Sepal.Width,
    y = Sepal.Length,
    facet_wrap = Species,
  )

mpg |>
  group_by(class, drv) |>
  summarise(
    mean = mean(hwy),
    lower = mean - sd(hwy),
    upper = mean + sd(hwy),
  ) |>
  gg_point(
    x = class,
    ymin = lower,
    y = mean,
    ymax = upper,
    fill = drv,
    position = position_dodge2(width = 0.25),
    before = geom_linerange(
      position = position_dodge2(width = 0.25),
    )
  )

penguins |>
  count(species, sex) |>
  tidyr::drop_na() |>
  gg_point(
    x = species,
    y = n,
    fill = sex,
    position = position_dodge(width = 0.2),
    before = geom_linerange(
      aes(ymin = 0, ymax = n),
      position = position_dodge(width = 0.2),
    ),
  )


Polygon ggplot

Description

A polygon ggplot with geom_polygon() defaults for the geom, stat and position.

Usage

gg_polygon(
  data,
  ...,
  geom = "polygon",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

tibble::tibble(
  x = c(0, 1, 1, 0, 2, 3, 3, 2),
  y = c(0, 0, 1, 1, 0, 0, 1, 1),
  group = c("a", "a", "a", "a", "b", "b", "b", "b"),
) |>
  gg_polygon(
    x = x,
    y = y,
    group = group,
  )

tibble::tibble(
  x = c(0, 1, 1, 0, 2, 3, 3, 2),
  y = c(0, 0, 1, 1, 0, 0, 1, 1),
  group = c("a", "a", "a", "a", "b", "b", "b", "b"),
) |>
  gg_polygon(
    x = x,
    y = y,
    group = group,
    fill = group,
  )

tibble::tibble(
  x = c(0, 1, 1, 0, 2, 3, 3, 2),
  y = c(0, 0, 1, 1, 0, 0, 1, 1),
  group = c("a", "a", "a", "a", "b", "b", "b", "b"),
) |>
  gg_polygon(
    x = x,
    y = y,
    group = group,
    facet_wrap = group,
  )


QQ ggplot

Description

A qq ggplot with geom_qq() defaults for the geom, stat and position. defaults for the geom, stat and position.

Usage

gg_qq(
  data,
  ...,
  geom = "qq",
  stat = "qq",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

library(ggplot2)

iris |>
  gg_qq(
    sample = Sepal.Width,
    before = geom_qq_line()
  )

iris |>
  gg_qq(
    sample = Sepal.Width,
    fill = Species,
    before = geom_qq_line()
  )

iris |>
  gg_qq(
    sample = Sepal.Width,
    facet_wrap = Species,
    before = geom_qq_line()
  )


Quantile ggplot

Description

A quantile ggplot with geom_quantile() defaults for the geom, stat and position.

Usage

gg_quantile(
  data,
  ...,
  geom = "quantile",
  stat = "quantile",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

if (requireNamespace("quantreg", quietly = TRUE)) {
  iris |>
    gg_quantile(
      x = Sepal.Width,
      y = Sepal.Length,
    )

  iris |>
    gg_quantile(
      x = Sepal.Width,
      y = Sepal.Length,
      fill = Species,
    )

  iris |>
    gg_quantile(
      x = Sepal.Width,
      y = Sepal.Length,
      facet_wrap = Species,
    )
}


Raster ggplot

Description

A raster ggplot with geom_raster() defaults for the geom, stat and position.

Note gg_raster defaults to colour = NA.

Usage

gg_raster(
  data,
  ...,
  geom = "raster",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::faithfuld |>
  gg_raster(
    x = waiting,
    y = eruptions,
    fill = density,
  )

ggplot2::faithfuld |>
  gg_raster(
    x = waiting,
    y = eruptions,
    fill = density,
  )

ggplot2::faithfuld |>
  dplyr::mutate(group = ifelse(waiting <= 65, "short", "long")) |>
  gg_raster(
    x = waiting,
    y = eruptions,
    fill = density,
    facet_wrap = group,
    facet_scales = "free_x",
  )


Rect ggplot

Description

A rect ggplot with geom_rect() defaults for the geom, stat and position.

Usage

gg_rect(
  data,
  ...,
  geom = "rect",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

tibble::tibble(
  xmin = c(1, 3),
  xmax = c(2, 4),
  ymin = c(1, 3),
  ymax = c(2, 4),
) |>
  gg_rect(
    xmin = xmin,
    xmax = xmax,
    ymin = ymin,
    ymax = ymax,
  )

tibble::tibble(
  xmin = c(1, 3),
  xmax = c(2, 4),
  ymin = c(1, 3),
  ymax = c(2, 4),
  group = c("a", "b"),
) |>
  gg_rect(
    xmin = xmin,
    xmax = xmax,
    ymin = ymin,
    ymax = ymax,
    fill = group,
  )

tibble::tibble(
  xmin = c(1, 3),
  xmax = c(2, 4),
  ymin = c(1, 3),
  ymax = c(2, 4),
  group = c("a", "b"),
) |>
  gg_rect(
    xmin = xmin,
    xmax = xmax,
    ymin = ymin,
    ymax = ymax,
    facet_wrap = group,
  )


Ribbon ggplot

Description

A ribbon ggplot with geom_ribbon() defaults for the geom, stat and position.

Usage

gg_ribbon(
  data,
  ...,
  geom = "ribbon",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

tibble::tibble(year = 1875:1972, level = as.vector(LakeHuron)) |>
  dplyr::mutate(lower = level - 1, upper = level + 1) |>
  gg_ribbon(
    x = year,
    ymin = lower,
    ymax = upper,
    x_labels = \(x) x,
  )

ggplot2::economics_long |>
  dplyr::mutate(lower = value01 - 0.05, upper = value01 + 0.05) |>
  gg_ribbon(
    x = date,
    ymin = lower,
    ymax = upper,
    fill = variable,
  )

ggplot2::economics_long |>
  dplyr::mutate(lower = value01 - 0.05, upper = value01 + 0.05) |>
  gg_ribbon(
    x = date,
    ymin = lower,
    ymax = upper,
    facet_wrap = variable,
  )


Segment ggplot

Description

A segment ggplot with geom_segment() defaults for the geom, stat and position.

Usage

gg_segment(
  data,
  ...,
  geom = "segment",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  gg_point(
    x = Sepal.Width,
    y = Sepal.Length,
  )

iris |>
  gg_point(
    x = Sepal.Width,
    y = Sepal.Length,
    fill = Species,
  )

iris |>
  gg_point(
    x = Sepal.Width,
    y = Sepal.Length,
    facet_wrap = Species,
  )

tibble::tibble(
  x = c(1, 3),
  xend = c(2, 4),
  y = c(1, 3),
  yend = c(2, 4),
) |>
  gg_segment(
    x = x,
    xend = xend,
    y = y,
    yend = yend,
  )

tibble::tibble(
  x = c(1, 3),
  xend = c(2, 4),
  y = c(1, 3),
  yend = c(2, 4),
  group = c("a", "b"),
) |>
  gg_segment(
    x = x,
    xend = xend,
    y = y,
    yend = yend,
    fill = group,
  )

tibble::tibble(
  x = c(1, 3),
  xend = c(2, 4),
  y = c(1, 3),
  yend = c(2, 4),
  group = c("a", "b"),
) |>
  gg_segment(
    x = x,
    xend = xend,
    y = y,
    yend = yend,
    facet_wrap = group,
  )


Sf ggplot

Description

A sf ggplot with geom_sf() defaults for the geom, stat and position.

Usage

gg_sf(
  data,
  ...,
  geom = "sf",
  stat = "sf",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

if (requireNamespace("sf", quietly = TRUE)) {

  d <- sf::st_read(system.file("shape/nc.shp", package = "sf"))

  d |>
    sf::st_centroid() |>
    gg_sf()

  d |>
    gg_sf(
      fill = AREA,
    )

}

Smooth ggplot

Description

A smooth ggplot with geom_smooth() defaults for the geom, stat and position.

Usage

gg_smooth(
  data,
  ...,
  geom = "smooth",
  stat = "smooth",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

iris |>
  gg_smooth(
    x = Sepal.Width,
    y = Sepal.Length,
  )

iris |>
  gg_smooth(
    x = Sepal.Width,
    y = Sepal.Length,
    fill = Species,
  )

iris |>
  gg_smooth(
    x = Sepal.Width,
    y = Sepal.Length,
    facet_wrap = Species,
  )


Spoke ggplot

Description

A spoke ggplot with geom_spoke() defaults for the geom, stat and position.

Usage

gg_spoke(
  data,
  ...,
  geom = "spoke",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

expand.grid(x = 1:10, y = 1:10) |>
  tibble::as_tibble() |>
  dplyr::mutate(
    angle = runif(100, 0, 2 * pi),
    speed = runif(100, 0, sqrt(0.1 * x)),
  ) |>
  gg_spoke(
    x = x,
    y = y,
    angle = angle,
    radius = speed,
  )

expand.grid(x = 1:10, y = 1:10) |>
  tibble::as_tibble() |>
  dplyr::mutate(
    angle = runif(100, 0, 2 * pi),
    speed = runif(100, 0, sqrt(0.1 * x)),
  ) |>
  gg_spoke(
    x = x,
    y = y,
    angle = angle,
    radius = speed,
    fill = speed,
  )

expand.grid(x = 1:10, y = 1:10) |>
  tibble::as_tibble() |>
  dplyr::mutate(
    angle = runif(100, 0, 2 * pi),
    speed = runif(100, 0, sqrt(0.1 * x)),
    group = ifelse(x <= 5, "left", "right"),
  ) |>
  gg_spoke(
    x = x,
    y = y,
    angle = angle,
    radius = speed,
    facet_wrap = group,
  )


Step ggplot

Description

A step ggplot with geom_step() defaults for the geom, stat and position.

Usage

gg_step(
  data,
  ...,
  geom = "step",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = FALSE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

library(dplyr)
library(ggplot2)

ggplot2::economics |>
  gg_step(
    x = date,
    y = unemploy,
    y_limits = \(x) range(x, 0),
  )

ggplot2::economics_long |>
  gg_step(
    x = date,
    y = value01,
    fill = variable,
  )

ggplot2::economics_long |>
  gg_step(
    x = date,
    y = value01,
    facet_wrap = ggplot2::vars(variable),
  )

ggplot2::economics_long |>
  group_by(variable) |>
  slice_head(n = 10) |>
  filter(variable != "psavert") |>
  gg_point(
    x = date,
    y = value01,
    fill = variable,
    before = geom_step(),
  )


Tile ggplot

Description

A tile ggplot with geom_tile() defaults for the geom, stat and position.

Usage

gg_tile(
  data,
  ...,
  geom = "tile",
  stat = "identity",
  position = ggplot2::position_identity(),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::faithfuld |>
 gg_tile(
   x = waiting,
   y = eruptions,
   fill = density,
   colour = NA,
 )

ggplot2::faithfuld |>
 dplyr::mutate(group = ifelse(waiting <= 65, "short", "long")) |>
 gg_tile(
   x = waiting,
   y = eruptions,
   fill = density,
   facet_wrap = ggplot2::vars(group),
   facet_scales = "free_x",
   colour = NA,
 )


Violin ggplot

Description

A violin ggplot with geom_violin() defaults for the geom, stat and position.

Usage

gg_violin(
  data,
  ...,
  geom = "violin",
  stat = "ydensity",
  position = ggplot2::position_dodge(preserve = "single"),
  before = NULL,
  with = NULL,
  focus = NULL,
  refine = NULL,
  border = TRUE,
  x = NULL,
  xmin = NULL,
  xmax = NULL,
  xend = NULL,
  xintercept = NULL,
  y = NULL,
  ymin = NULL,
  ymax = NULL,
  yend = NULL,
  yintercept = NULL,
  z = NULL,
  fill = NULL,
  colour = NULL,
  alpha = NULL,
  shape = NULL,
  linetype = NULL,
  linewidth = NULL,
  size = NULL,
  stroke = NULL,
  label = NULL,
  weight = NULL,
  group = NULL,
  width = NULL,
  height = NULL,
  slope = NULL,
  intercept = NULL,
  sample = NULL,
  angle = NULL,
  radius = NULL,
  mapping = ggplot2::aes(),
  x_type = NULL,
  x_subtype = NULL,
  x_breaks = NULL,
  x_drop = TRUE,
  x_expand = NULL,
  x_guide = ggplot2::waiver(),
  x_labels = NULL,
  x_limits = NULL,
  x_minor_breaks = ggplot2::waiver(),
  x_name = ggplot2::waiver(),
  x_oob = scales::oob_censor,
  x_palette = seq_len,
  x_position = "bottom",
  x_sec_axis = ggplot2::waiver(),
  x_transform = NULL,
  y_type = NULL,
  y_subtype = NULL,
  y_breaks = NULL,
  y_drop = TRUE,
  y_expand = NULL,
  y_guide = ggplot2::waiver(),
  y_labels = NULL,
  y_limits = NULL,
  y_minor_breaks = ggplot2::waiver(),
  y_name = ggplot2::waiver(),
  y_oob = scales::oob_censor,
  y_palette = seq_len,
  y_position = "left",
  y_sec_axis = ggplot2::waiver(),
  y_transform = NULL,
  fill_type = NULL,
  fill_subtype = NULL,
  fill_breaks = ggplot2::waiver(),
  fill_drop = TRUE,
  fill_guide = NULL,
  fill_labels = NULL,
  fill_limits = NULL,
  fill_name = ggplot2::waiver(),
  fill_oob = scales::oob_censor,
  fill_rescaler = scales::rescale,
  fill_palette = NULL,
  fill_transform = NULL,
  colour_type = NULL,
  colour_subtype = NULL,
  colour_breaks = NULL,
  colour_drop = NULL,
  colour_guide = NULL,
  colour_labels = NULL,
  colour_limits = NULL,
  colour_name = NULL,
  colour_oob = NULL,
  colour_rescaler = NULL,
  colour_palette = NULL,
  colour_transform = NULL,
  alpha_type = NULL,
  alpha_subtype = NULL,
  alpha_breaks = ggplot2::waiver(),
  alpha_drop = TRUE,
  alpha_guide = NULL,
  alpha_labels = NULL,
  alpha_limits = NULL,
  alpha_name = ggplot2::waiver(),
  alpha_oob = scales::oob_censor,
  alpha_palette = NULL,
  alpha_transform = NULL,
  size_type = NULL,
  size_subtype = NULL,
  size_breaks = ggplot2::waiver(),
  size_drop = TRUE,
  size_guide = NULL,
  size_labels = NULL,
  size_limits = NULL,
  size_name = ggplot2::waiver(),
  size_oob = scales::oob_censor,
  size_palette = NULL,
  size_transform = NULL,
  linewidth_type = NULL,
  linewidth_subtype = NULL,
  linewidth_breaks = ggplot2::waiver(),
  linewidth_drop = TRUE,
  linewidth_guide = NULL,
  linewidth_labels = NULL,
  linewidth_limits = NULL,
  linewidth_name = ggplot2::waiver(),
  linewidth_oob = scales::oob_censor,
  linewidth_palette = NULL,
  linewidth_transform = NULL,
  linetype_type = NULL,
  linetype_breaks = ggplot2::waiver(),
  linetype_drop = TRUE,
  linetype_guide = NULL,
  linetype_labels = NULL,
  linetype_limits = NULL,
  linetype_name = ggplot2::waiver(),
  linetype_palette = NULL,
  shape_type = NULL,
  shape_breaks = ggplot2::waiver(),
  shape_drop = TRUE,
  shape_guide = NULL,
  shape_labels = NULL,
  shape_limits = NULL,
  shape_name = ggplot2::waiver(),
  shape_palette = NULL,
  facet_wrap = NULL,
  facet_rows = NULL,
  facet_cols = NULL,
  facet_axes = "margins",
  facet_axis_labels = "all",
  facet_drop = TRUE,
  facet_labeller = "label_value",
  facet_ncol = NULL,
  facet_nrow = NULL,
  facet_scales = "fixed",
  facet_space = "fixed",
  coord_xlim = NULL,
  coord_ylim = NULL,
  coord_clip = NULL,
  coord_reverse = "none",
  coord_ratio = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ggplot = NULL
)

Arguments

data

A data frame.

...

Arguments passed to the geom layer, including geom params.

geom

A geom as a string ("point"). Note relevant geom library must be loaded.

stat

A stat as a string ("identity"). Note relevant stat library must be loaded.

position

A position as a function (ggplot2::position_identity()).

before

A ggplot2 layer to add before the geom layer. Unaffected by border transformations.

with

A function to apply to the geom layer.

focus

The orientation focus of the plot. Either "x" (default) or "y" for horizontal plots. Auto-detected from scale types.

refine

A function to refine the theme based on focus and scale types. Defaults to ggrefine::modern.

border

Whether to apply border colour and linewidth. TRUE forces border on, FALSE forces off.

x

Variable mapped to x.

xmin

Variable mapped to xmin.

xmax

Variable mapped to xmax.

xend

Variable mapped to xend.

xintercept

Variable mapped to xintercept.

y

Variable mapped to y.

ymin

Variable mapped to ymin.

ymax

Variable mapped to ymax.

yend

Variable mapped to yend.

yintercept

Variable mapped to yintercept.

z

Variable mapped to z.

fill

Variable mapped to fill, or a set value. When mapped, colour inherits the same mapping unless colour is specified separately.

colour

Variable mapped to colour, or a set value. When not specified and fill is mapped, colour inherits from fill.

alpha

Variable mapped to alpha, or a set value.

shape

Variable mapped to shape, or a set value.

linetype

Variable mapped to linetype, or a set value.

linewidth

Variable mapped to linewidth, or a set value.

size

Variable mapped to size, or a set value.

stroke

Variable mapped to stroke, or a set value.

label

Variable mapped to label, or a set value.

weight

Variable mapped to weight, or a set value.

group

Variable mapped to group, or a set value.

width

Variable mapped to width, or a set value.

height

Variable mapped to height, or a set value.

slope

Variable mapped to slope, or a set value.

intercept

Variable mapped to intercept, or a set value.

sample

Variable mapped to sample, or a set value.

angle

Variable mapped to angle, or a set value.

radius

Variable mapped to radius, or a set value.

mapping

Additional aesthetic mappings from ggplot2::aes(), merged with individual aesthetic arguments.

x_type

Scale type for x. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

x_subtype

Scale subtype for x. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

x_breaks

Breaks for the x scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

x_drop

Whether to drop unused levels for a discrete x scale. Defaults to TRUE.

x_expand

Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

x_guide

Guide for the x scale. Defaults to ggplot2::waiver().

x_labels

Labels for the x scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

x_limits

Limits for the x scale. Accepts a vector or a function.

x_minor_breaks

Minor breaks for the x scale.

x_name

Name/title for the x scale. Defaults to ggplot2::waiver().

x_oob

Out-of-bounds handler for the x scale. Defaults to scales::oob_censor.

x_palette

Palette for a discrete x scale. Defaults to seq_len.

x_position

Position of the x axis. Either "bottom" (default) or "top".

x_sec_axis

Secondary axis for x. Defaults to ggplot2::waiver().

x_transform

Transform for the x scale. Auto-detected from subtype if NULL.

y_type

Scale type for y. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

y_subtype

Scale subtype for y. One of "date", "datetime", "time", or NA. Auto-detected if NULL.

y_breaks

Breaks for the y scale. Defaults to scales::breaks_pretty() for date/datetime subtypes, otherwise scales::breaks_extended().

y_drop

Whether to drop unused levels for a discrete y scale. Defaults to TRUE.

y_expand

Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5% expansion.

y_guide

Guide for the y scale. Defaults to ggplot2::waiver().

y_labels

Labels for the y scale. Defaults to scales::label_date_short() for date/datetime, otherwise scales::label_number().

y_limits

Limits for the y scale. Accepts a vector or a function.

y_minor_breaks

Minor breaks for the y scale.

y_name

Name/title for the y scale. Defaults to ggplot2::waiver().

y_oob

Out-of-bounds handler for the y scale. Defaults to scales::oob_censor.

y_palette

Palette for a discrete y scale. Defaults to seq_len.

y_position

Position of the y axis. Either "left" (default) or "right".

y_sec_axis

Secondary axis for y. Defaults to ggplot2::waiver().

y_transform

Transform for the y scale. Auto-detected from subtype if NULL.

fill_type

Scale type for fill. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

fill_subtype

Scale subtype for fill. Auto-detected if NULL.

fill_breaks

Breaks for the fill scale.

fill_drop

Whether to drop unused levels for a discrete fill scale. Defaults to TRUE.

fill_guide

Guide for the fill scale.

fill_labels

Labels for the fill scale.

fill_limits

Limits for the fill scale.

fill_name

Name/title for the fill scale.

fill_oob

Out-of-bounds handler for the fill scale. Defaults to scales::oob_censor.

fill_rescaler

Rescaler for the fill scale. Defaults to scales::rescale.

fill_palette

Palette for the fill scale.

fill_transform

Transform for the fill scale. Auto-detected from subtype if NULL.

colour_type

Scale type for colour. Inherits from fill_type if NULL.

colour_subtype

Scale subtype for colour. Inherits from fill_subtype if NULL.

colour_breaks

Breaks for the colour scale. Inherits from fill_breaks if NULL.

colour_drop

Whether to drop unused levels for a discrete colour scale. Inherits from fill_drop if NULL.

colour_guide

Guide for the colour scale. Inherits from fill_guide if NULL.

colour_labels

Labels for the colour scale. Inherits from fill_labels if NULL.

colour_limits

Limits for the colour scale. Inherits from fill_limits if NULL.

colour_name

Name/title for the colour scale. Inherits from fill_name if NULL.

colour_oob

Out-of-bounds handler for the colour scale. Inherits from fill_oob if NULL.

colour_rescaler

Rescaler for the colour scale. Inherits from fill_rescaler if NULL.

colour_palette

Palette for the colour scale.

colour_transform

Transform for the colour scale. Inherits from fill_transform if NULL.

alpha_type

Scale type for alpha. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

alpha_subtype

Scale subtype for alpha. Auto-detected if NULL.

alpha_breaks

Breaks for the alpha scale.

alpha_drop

Whether to drop unused levels for a discrete alpha scale. Defaults to TRUE.

alpha_guide

Guide for the alpha scale. Defaults to NULL.

alpha_labels

Labels for the alpha scale.

alpha_limits

Limits for the alpha scale.

alpha_name

Name/title for the alpha scale.

alpha_oob

Out-of-bounds handler for the alpha scale. Defaults to scales::oob_censor.

alpha_palette

Palette for the alpha scale.

alpha_transform

Transform for the alpha scale.

size_type

Scale type for size. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

size_subtype

Scale subtype for size. Auto-detected if NULL.

size_breaks

Breaks for the size scale.

size_drop

Whether to drop unused levels for a discrete size scale. Defaults to TRUE.

size_guide

Guide for the size scale. Defaults to NULL.

size_labels

Labels for the size scale.

size_limits

Limits for the size scale.

size_name

Name/title for the size scale.

size_oob

Out-of-bounds handler for the size scale. Defaults to scales::oob_censor.

size_palette

Palette for the size scale.

size_transform

Transform for the size scale.

linewidth_type

Scale type for linewidth. One of "continuous", "discrete", or "binned". Auto-detected if NULL.

linewidth_subtype

Scale subtype for linewidth. Auto-detected if NULL.

linewidth_breaks

Breaks for the linewidth scale.

linewidth_drop

Whether to drop unused levels for a discrete linewidth scale. Defaults to TRUE.

linewidth_guide

Guide for the linewidth scale. Defaults to NULL.

linewidth_labels

Labels for the linewidth scale.

linewidth_limits

Limits for the linewidth scale.

linewidth_name

Name/title for the linewidth scale.

linewidth_oob

Out-of-bounds handler for the linewidth scale. Defaults to scales::oob_censor.

linewidth_palette

Palette for the linewidth scale.

linewidth_transform

Transform for the linewidth scale.

linetype_type

Scale type for linetype. Only "discrete" is supported.

linetype_breaks

Breaks for the linetype scale.

linetype_drop

Whether to drop unused levels for the linetype scale. Defaults to TRUE.

linetype_guide

Guide for the linetype scale. Defaults to NULL.

linetype_labels

Labels for the linetype scale.

linetype_limits

Limits for the linetype scale.

linetype_name

Name/title for the linetype scale.

linetype_palette

Palette for the linetype scale.

shape_type

Scale type for shape. Only "discrete" is supported.

shape_breaks

Breaks for the shape scale.

shape_drop

Whether to drop unused levels for the shape scale. Defaults to TRUE.

shape_guide

Guide for the shape scale. Defaults to NULL.

shape_labels

Labels for the shape scale.

shape_limits

Limits for the shape scale.

shape_name

Name/title for the shape scale.

shape_palette

Palette for the shape scale.

facet_wrap

Variables to facet by, passed to ggplot2::facet_wrap(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_rows

Row variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_cols

Column variables for ggplot2::facet_grid(). Accepts a bare variable name or ggplot2::vars() for multiple variables.

facet_axes

Which axes to draw on facet panels. Defaults to "margins".

facet_axis_labels

Which axis labels to draw on facet panels. Defaults to "all".

facet_drop

Whether to drop unused factor levels in facets. Defaults to TRUE.

facet_labeller

Labeller for facet strip labels. Defaults to "label_value".

facet_ncol

Number of columns for ggplot2::facet_wrap().

facet_nrow

Number of rows for ggplot2::facet_wrap().

facet_scales

Whether facet scales are fixed or free. Defaults to "fixed".

facet_space

Whether facet space is fixed or free. Defaults to "fixed".

coord_xlim, coord_ylim

Zoom limits within the coordinate system.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off".

coord_reverse

Which axes to reverse. One of "none" (default), "x", "y", or "xy".

coord_ratio

Aspect ratio expressed as y / x, for ggplot2::coord_cartesian().

title

Plot title passed to ggplot2::labs().

subtitle

Plot subtitle passed to ggplot2::labs().

caption

Plot caption passed to ggplot2::labs().

ggplot

A base ggplot object to use. Defaults to NULL, which uses ⁠\(x) ggplot2::ggplot(x)⁠.

Value

A ggplot object.

Examples

ggplot2::diamonds |>
  gg_violin(
    x = color,
    y = carat,
    y_limits = c(0, NA),
  )

ggplot2::diamonds |>
  gg_violin(
    x = color,
    y = carat,
    fill = cut,
    y_limits = c(0, NA),
  )

ggplot2::diamonds |>
  dplyr::filter(cut %in% c("Premium", "Ideal")) |>
  gg_violin(
    x = color,
    y = carat,
    facet_wrap = ggplot2::vars(cut),
    y_limits = c(0, NA),
  )


Set ggblanket defaults

Description

Use set_blanket to:

Usage

set_blanket(
  ...,
  theme = ggrefine::theme_grey(),
  refine = ggrefine::modern,
  fill = "#357BA2FF",
  fill_palette = list(jumble::jumble, viridis::turbo(n = 256)),
  fill_border = NULL,
  colour = fill,
  colour_palette = fill_palette,
  colour_border = NULL,
  linewidth = 0.66,
  linewidth_border = 0.33,
  shape = 21,
  shape_palette = scales::pal_manual(c(21, 24, 22, 23, 25)),
  linetype = 1,
  linetype_palette = scales::pal_manual(1:6),
  size = 1.5,
  stroke = 0.33,
  coord_clip = "off"
)

Arguments

...

Not used. Forces named arguments.

theme

A ggplot2 theme. Defaults to ggrefine::theme_grey().

refine

A refine function. Defaults to ggrefine::modern.

fill

Default fill colour. Defaults to "#357BA2FF".

fill_palette

Palette for fill scales. A single discrete palette or list(discrete, continuous). Defaults to list(jumble::jumble, viridis::turbo(n = 256)).

fill_border

When border = TRUE, a function applied to fill and fill_palette to derive the fill. Defaults to ⁠\(x) x⁠.

colour

Default colour. Defaults to fill.

colour_palette

Palette for colour scales. Same format as fill_palette. Defaults to fill_palette.

colour_border

When border = TRUE, a function applied to fill and fill_palette to derive the colour. If fill_border is NULL, defaults to blends::multiply() for light panels and blends::screen() for dark panels. Otherwise defaults to ⁠\(x) x⁠.

linewidth

Default linewidth. Defaults to 0.66.

linewidth_border

When border = TRUE, the default linewidth. Defaults to 0.33.

shape

Default point shape. Defaults to 21.

shape_palette

Palette for shape scales. Defaults to scales::pal_manual(c(21, 24, 22, 23, 25)).

linetype

Default linetype. Defaults to 1.

linetype_palette

Palette for linetype scales. Defaults to scales::pal_manual(1:6).

size

Default point size. Defaults to 1.5.

stroke

Default stroke for point geoms. Defaults to 0.33.

coord_clip

Whether drawing is clipped to the panel. Either "on" or "off" (default).

Value

Called for side effects.

See Also

scales::number_options()

Examples

set_blanket(
  fill_palette = scales::pal_hue(),
)

palmerpenguins::penguins |>
  gg_density(
    x = flipper_length_mm,
    fill = species,
  )

set_blanket(
  fill_palette = scales::pal_hue(),
  fill_border = \(x) scales::alpha(x, 0.75),
)

palmerpenguins::penguins |>
  gg_density(
    x = flipper_length_mm,
    fill = species,
  )

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.