line_plot: line_plot

View source: R/line_plot.R

line_plotR Documentation

line_plot

Description

Creates line plots.

Usage

line_plot(
  data,
  x,
  y = "1",
  group = NULL,
  facet_x = NULL,
  facet_y = NULL,
  yoy = FALSE,
  size_line = 1,
  size = 11,
  reorder = c("group", "facet_x", "facet_y"),
  palette = ez_col,
  labels_y = ez_labels,
  limits_y = c(NA, NA),
  use_theme = theme_ez,
  facet_scales = "fixed",
  legend_ncol = NULL
)

Arguments

data

A data.frame.

x

A named character value. Evaluates to a column.

y

A named character value. Evaluates to a column.

group

A character value. Evaluates to a column.

facet_x

A character value. Evaluates to a column.

facet_y

A character. Evaluates to a column.

yoy

Logical used to indicate whether a YOY grouping should be created. Default is FALSE.

size_line

width of line for geom_line(). Default is 1.

size

theme size for use_theme(). Default is 14.

reorder

A character vector specifying the group variables to reorder. Default is c("group", "facet_x", "facet_y").

palette

Colour function.

labels_y

label formatting function

limits_y

vector of c(min, max) y-axis limits

use_theme

ggplot theme function

facet_scales

Option passed to scales argument in facet_wrap or facet_grid. Default is "fixed".

legend_ncol

Number of columns in legend.

Value

A ggplot object.

Examples

suppressPackageStartupMessages(library(tsibble))
library(tsibbledata)
line_plot(ansett, x = "Week", y = "Passengers")
line_plot(ansett, x = "Week", y = "Passengers", "Class")
line_plot(pelt, "Year", "Hare", limits_y = c(0, NA))
line_plot(pelt, "Year", c("Hare", "Lynx"))
line_plot(pelt, "Year", "Hare", use_theme = ggplot2::theme_bw)
line_plot(pelt, "Year", c("Hare Population" = "Hare"))

ezplot documentation built on Aug. 12, 2022, 1:07 a.m.