add_line: Add a line to a ggplot

View source: R/add_line.R

add_lineR Documentation

Add a line to a ggplot

Description

Add a line to a ggplot

Usage

add_line(data, y)

Arguments

data

A data frame

y

The name of the variable to plot as a line (as a string)

Details

This function maps variable y to the y aesthetic of a geom_line and adds it to a preexisting ggplot.

Note

y cannot be "y".

Examples


data <- tibble::tibble(x = 1:3, z = 3:1)

ggplot2::ggplot(data, ggplot2::aes(x = x, y = x)) +
  ggplot2::geom_line() +
  add_line(data, "z")


rscherrer/speciomer documentation built on March 11, 2023, 5:37 p.m.