Skip to contents

Produces a simple line chart in ggplot2 which can be customised for publication

Usage

plot_line_chart(
  data,
  x,
  y,
  group,
  line_colour = "ByGroup",
  line_width = 1,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  subtitle = NULL,
  caption = NULL
)

Arguments

data

data frame

x

numeric column of data

y

numeric column of data

group

character or factor column of data defining individual lines

line_colour

line colour

line_width

line width

xlab

x-axis title

ylab

y-axis title

title

plot title

subtitle

plot subtitle

caption

plot caption

Value

An object of class ggplot

Details

The line_chart() function can produce multiple lines if a grouping variable is supplied. A specific colour can be specified for single lines. Data should be in long format.

Examples

plot_line_chart(data, x, y)
#> Error in plot_line_chart(data, x, y): Data needs to be a data frame