% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gg-line.R
\name{gg_line}
\alias{gg_line}
\title{Line ggplot}
\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{
\item{data}{A data frame.}

\item{...}{Arguments passed to the geom layer, including geom params.}

\item{geom}{A geom as a string (\code{"point"}). Note relevant geom library must be loaded.}

\item{stat}{A stat as a string (\code{"identity"}). Note relevant stat library must be loaded.}

\item{position}{A position as a function (\code{ggplot2::position_identity()}).}

\item{before}{A ggplot2 layer to add before the geom layer. Unaffected by border transformations.}

\item{with}{A function to apply to the geom layer.}

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

\item{refine}{A function to refine the theme based on focus and scale types. Defaults to \code{ggrefine::modern}.}

\item{border}{Whether to apply border colour and linewidth. \code{TRUE} forces border on, \code{FALSE} forces off.}

\item{x}{Variable mapped to x.}

\item{xmin}{Variable mapped to xmin.}

\item{xmax}{Variable mapped to xmax.}

\item{xend}{Variable mapped to xend.}

\item{xintercept}{Variable mapped to xintercept.}

\item{y}{Variable mapped to y.}

\item{ymin}{Variable mapped to ymin.}

\item{ymax}{Variable mapped to ymax.}

\item{yend}{Variable mapped to yend.}

\item{yintercept}{Variable mapped to yintercept.}

\item{z}{Variable mapped to z.}

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

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

\item{alpha}{Variable mapped to alpha, or a set value.}

\item{shape}{Variable mapped to shape, or a set value.}

\item{linetype}{Variable mapped to linetype, or a set value.}

\item{linewidth}{Variable mapped to linewidth, or a set value.}

\item{size}{Variable mapped to size, or a set value.}

\item{stroke}{Variable mapped to stroke, or a set value.}

\item{label}{Variable mapped to label, or a set value.}

\item{weight}{Variable mapped to weight, or a set value.}

\item{group}{Variable mapped to group, or a set value.}

\item{width}{Variable mapped to width, or a set value.}

\item{height}{Variable mapped to height, or a set value.}

\item{slope}{Variable mapped to slope, or a set value.}

\item{intercept}{Variable mapped to intercept, or a set value.}

\item{sample}{Variable mapped to sample, or a set value.}

\item{angle}{Variable mapped to angle, or a set value.}

\item{radius}{Variable mapped to radius, or a set value.}

\item{mapping}{Additional aesthetic mappings from \code{\link[ggplot2:aes]{ggplot2::aes()}}, merged with individual aesthetic arguments.}

\item{x_type}{Scale type for x. One of \code{"continuous"}, \code{"discrete"}, or \code{"binned"}. Auto-detected if \code{NULL}.}

\item{x_subtype}{Scale subtype for x. One of \code{"date"}, \code{"datetime"}, \code{"time"}, or \code{NA}. Auto-detected if \code{NULL}.}

\item{x_breaks}{Breaks for the x scale. Defaults to \code{\link[scales:breaks_pretty]{scales::breaks_pretty()}} for date/datetime subtypes, otherwise \code{\link[scales:breaks_extended]{scales::breaks_extended()}}.}

\item{x_drop}{Whether to drop unused levels for a discrete x scale. Defaults to \code{TRUE}.}

\item{x_expand}{Expansion for the x scale. Defaults to zero expansion where the limit is zero, otherwise 5\% expansion.}

\item{x_guide}{Guide for the x scale. Defaults to \code{\link[ggplot2:waiver]{ggplot2::waiver()}}.}

\item{x_labels}{Labels for the x scale. Defaults to \code{\link[scales:label_date]{scales::label_date_short()}} for date/datetime, otherwise \code{\link[scales:label_number]{scales::label_number()}}.}

\item{x_limits}{Limits for the x scale. Accepts a vector or a function.}

\item{x_minor_breaks}{Minor breaks for the x scale.}

\item{x_name}{Name/title for the x scale. Defaults to \code{\link[ggplot2:waiver]{ggplot2::waiver()}}.}

\item{x_oob}{Out-of-bounds handler for the x scale. Defaults to \link[scales:oob]{scales::oob_censor}.}

\item{x_palette}{Palette for a discrete x scale. Defaults to \code{seq_len}.}

\item{x_position}{Position of the x axis. Either \code{"bottom"} (default) or \code{"top"}.}

\item{x_sec_axis}{Secondary axis for x. Defaults to \code{\link[ggplot2:waiver]{ggplot2::waiver()}}.}

\item{x_transform}{Transform for the x scale. Auto-detected from subtype if \code{NULL}.}

\item{y_type}{Scale type for y. One of \code{"continuous"}, \code{"discrete"}, or \code{"binned"}. Auto-detected if \code{NULL}.}

\item{y_subtype}{Scale subtype for y. One of \code{"date"}, \code{"datetime"}, \code{"time"}, or \code{NA}. Auto-detected if \code{NULL}.}

\item{y_breaks}{Breaks for the y scale. Defaults to \code{\link[scales:breaks_pretty]{scales::breaks_pretty()}} for date/datetime subtypes, otherwise \code{\link[scales:breaks_extended]{scales::breaks_extended()}}.}

\item{y_drop}{Whether to drop unused levels for a discrete y scale. Defaults to \code{TRUE}.}

\item{y_expand}{Expansion for the y scale. Defaults to zero expansion where the limit is zero, otherwise 5\% expansion.}

\item{y_guide}{Guide for the y scale. Defaults to \code{\link[ggplot2:waiver]{ggplot2::waiver()}}.}

\item{y_labels}{Labels for the y scale. Defaults to \code{\link[scales:label_date]{scales::label_date_short()}} for date/datetime, otherwise \code{\link[scales:label_number]{scales::label_number()}}.}

\item{y_limits}{Limits for the y scale. Accepts a vector or a function.}

\item{y_minor_breaks}{Minor breaks for the y scale.}

\item{y_name}{Name/title for the y scale. Defaults to \code{\link[ggplot2:waiver]{ggplot2::waiver()}}.}

\item{y_oob}{Out-of-bounds handler for the y scale. Defaults to \link[scales:oob]{scales::oob_censor}.}

\item{y_palette}{Palette for a discrete y scale. Defaults to \code{seq_len}.}

\item{y_position}{Position of the y axis. Either \code{"left"} (default) or \code{"right"}.}

\item{y_sec_axis}{Secondary axis for y. Defaults to \code{\link[ggplot2:waiver]{ggplot2::waiver()}}.}

\item{y_transform}{Transform for the y scale. Auto-detected from subtype if \code{NULL}.}

\item{fill_type}{Scale type for fill. One of \code{"continuous"}, \code{"discrete"}, or \code{"binned"}. Auto-detected if \code{NULL}.}

\item{fill_subtype}{Scale subtype for fill. Auto-detected if \code{NULL}.}

\item{fill_breaks}{Breaks for the fill scale.}

\item{fill_drop}{Whether to drop unused levels for a discrete fill scale. Defaults to \code{TRUE}.}

\item{fill_guide}{Guide for the fill scale.}

\item{fill_labels}{Labels for the fill scale.}

\item{fill_limits}{Limits for the fill scale.}

\item{fill_name}{Name/title for the fill scale.}

\item{fill_oob}{Out-of-bounds handler for the fill scale. Defaults to \link[scales:oob]{scales::oob_censor}.}

\item{fill_rescaler}{Rescaler for the fill scale. Defaults to \link[scales:rescale]{scales::rescale}.}

\item{fill_palette}{Palette for the fill scale.}

\item{fill_transform}{Transform for the fill scale. Auto-detected from subtype if \code{NULL}.}

\item{colour_type}{Scale type for colour. Inherits from \code{fill_type} if \code{NULL}.}

\item{colour_subtype}{Scale subtype for colour. Inherits from \code{fill_subtype} if \code{NULL}.}

\item{colour_breaks}{Breaks for the colour scale. Inherits from \code{fill_breaks} if \code{NULL}.}

\item{colour_drop}{Whether to drop unused levels for a discrete colour scale. Inherits from \code{fill_drop} if \code{NULL}.}

\item{colour_guide}{Guide for the colour scale. Inherits from \code{fill_guide} if \code{NULL}.}

\item{colour_labels}{Labels for the colour scale. Inherits from \code{fill_labels} if \code{NULL}.}

\item{colour_limits}{Limits for the colour scale. Inherits from \code{fill_limits} if \code{NULL}.}

\item{colour_name}{Name/title for the colour scale. Inherits from \code{fill_name} if \code{NULL}.}

\item{colour_oob}{Out-of-bounds handler for the colour scale. Inherits from \code{fill_oob} if \code{NULL}.}

\item{colour_rescaler}{Rescaler for the colour scale. Inherits from \code{fill_rescaler} if \code{NULL}.}

\item{colour_palette}{Palette for the colour scale.}

\item{colour_transform}{Transform for the colour scale. Inherits from \code{fill_transform} if \code{NULL}.}

\item{alpha_type}{Scale type for alpha. One of \code{"continuous"}, \code{"discrete"}, or \code{"binned"}. Auto-detected if \code{NULL}.}

\item{alpha_subtype}{Scale subtype for alpha. Auto-detected if \code{NULL}.}

\item{alpha_breaks}{Breaks for the alpha scale.}

\item{alpha_drop}{Whether to drop unused levels for a discrete alpha scale. Defaults to \code{TRUE}.}

\item{alpha_guide}{Guide for the alpha scale. Defaults to \code{NULL}.}

\item{alpha_labels}{Labels for the alpha scale.}

\item{alpha_limits}{Limits for the alpha scale.}

\item{alpha_name}{Name/title for the alpha scale.}

\item{alpha_oob}{Out-of-bounds handler for the alpha scale. Defaults to \link[scales:oob]{scales::oob_censor}.}

\item{alpha_palette}{Palette for the alpha scale.}

\item{alpha_transform}{Transform for the alpha scale.}

\item{size_type}{Scale type for size. One of \code{"continuous"}, \code{"discrete"}, or \code{"binned"}. Auto-detected if \code{NULL}.}

\item{size_subtype}{Scale subtype for size. Auto-detected if \code{NULL}.}

\item{size_breaks}{Breaks for the size scale.}

\item{size_drop}{Whether to drop unused levels for a discrete size scale. Defaults to \code{TRUE}.}

\item{size_guide}{Guide for the size scale. Defaults to \code{NULL}.}

\item{size_labels}{Labels for the size scale.}

\item{size_limits}{Limits for the size scale.}

\item{size_name}{Name/title for the size scale.}

\item{size_oob}{Out-of-bounds handler for the size scale. Defaults to \link[scales:oob]{scales::oob_censor}.}

\item{size_palette}{Palette for the size scale.}

\item{size_transform}{Transform for the size scale.}

\item{linewidth_type}{Scale type for linewidth. One of \code{"continuous"}, \code{"discrete"}, or \code{"binned"}. Auto-detected if \code{NULL}.}

\item{linewidth_subtype}{Scale subtype for linewidth. Auto-detected if \code{NULL}.}

\item{linewidth_breaks}{Breaks for the linewidth scale.}

\item{linewidth_drop}{Whether to drop unused levels for a discrete linewidth scale. Defaults to \code{TRUE}.}

\item{linewidth_guide}{Guide for the linewidth scale. Defaults to \code{NULL}.}

\item{linewidth_labels}{Labels for the linewidth scale.}

\item{linewidth_limits}{Limits for the linewidth scale.}

\item{linewidth_name}{Name/title for the linewidth scale.}

\item{linewidth_oob}{Out-of-bounds handler for the linewidth scale. Defaults to \link[scales:oob]{scales::oob_censor}.}

\item{linewidth_palette}{Palette for the linewidth scale.}

\item{linewidth_transform}{Transform for the linewidth scale.}

\item{linetype_type}{Scale type for linetype. Only \code{"discrete"} is supported.}

\item{linetype_breaks}{Breaks for the linetype scale.}

\item{linetype_drop}{Whether to drop unused levels for the linetype scale. Defaults to \code{TRUE}.}

\item{linetype_guide}{Guide for the linetype scale. Defaults to \code{NULL}.}

\item{linetype_labels}{Labels for the linetype scale.}

\item{linetype_limits}{Limits for the linetype scale.}

\item{linetype_name}{Name/title for the linetype scale.}

\item{linetype_palette}{Palette for the linetype scale.}

\item{shape_type}{Scale type for shape. Only \code{"discrete"} is supported.}

\item{shape_breaks}{Breaks for the shape scale.}

\item{shape_drop}{Whether to drop unused levels for the shape scale. Defaults to \code{TRUE}.}

\item{shape_guide}{Guide for the shape scale. Defaults to \code{NULL}.}

\item{shape_labels}{Labels for the shape scale.}

\item{shape_limits}{Limits for the shape scale.}

\item{shape_name}{Name/title for the shape scale.}

\item{shape_palette}{Palette for the shape scale.}

\item{facet_wrap}{Variables to facet by, passed to \code{\link[ggplot2:facet_wrap]{ggplot2::facet_wrap()}}. Accepts a bare variable name or \code{\link[ggplot2:vars]{ggplot2::vars()}} for multiple variables.}

\item{facet_rows}{Row variables for \code{\link[ggplot2:facet_grid]{ggplot2::facet_grid()}}. Accepts a bare variable name or \code{\link[ggplot2:vars]{ggplot2::vars()}} for multiple variables.}

\item{facet_cols}{Column variables for \code{\link[ggplot2:facet_grid]{ggplot2::facet_grid()}}. Accepts a bare variable name or \code{\link[ggplot2:vars]{ggplot2::vars()}} for multiple variables.}

\item{facet_axes}{Which axes to draw on facet panels. Defaults to \code{"margins"}.}

\item{facet_axis_labels}{Which axis labels to draw on facet panels. Defaults to \code{"all"}.}

\item{facet_drop}{Whether to drop unused factor levels in facets. Defaults to \code{TRUE}.}

\item{facet_labeller}{Labeller for facet strip labels. Defaults to \code{"label_value"}.}

\item{facet_ncol}{Number of columns for \code{\link[ggplot2:facet_wrap]{ggplot2::facet_wrap()}}.}

\item{facet_nrow}{Number of rows for \code{\link[ggplot2:facet_wrap]{ggplot2::facet_wrap()}}.}

\item{facet_scales}{Whether facet scales are fixed or free. Defaults to \code{"fixed"}.}

\item{facet_space}{Whether facet space is fixed or free. Defaults to \code{"fixed"}.}

\item{coord_xlim, coord_ylim}{Zoom limits within the coordinate system.}

\item{coord_clip}{Whether drawing is clipped to the panel. Either \code{"on"} or \code{"off"}.}

\item{coord_reverse}{Which axes to reverse. One of \code{"none"} (default), \code{"x"}, \code{"y"}, or \code{"xy"}.}

\item{coord_ratio}{Aspect ratio expressed as y / x, for \code{\link[ggplot2:coord_cartesian]{ggplot2::coord_cartesian()}}.}

\item{title}{Plot title passed to \code{\link[ggplot2:labs]{ggplot2::labs()}}.}

\item{subtitle}{Plot subtitle passed to \code{\link[ggplot2:labs]{ggplot2::labs()}}.}

\item{caption}{Plot caption passed to \code{\link[ggplot2:labs]{ggplot2::labs()}}.}

\item{ggplot}{A base ggplot object to use. Defaults to \code{NULL}, which uses \verb{\\(x) ggplot2::ggplot(x)}.}
}
\value{
A ggplot object.
}
\description{
A line ggplot with \link[ggplot2:geom_path]{geom_line()} defaults for the geom, stat and position.
}
\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(),
  )

}
