Wrapper around [ggplot2::geom_line()] that plots pretty line plots using a custom ggplot theme.

plot_line(
  data,
  x_str,
  y_str,
  color_str = NULL,
  theme_options = NULL,
  show_plot = FALSE,
  ...
)

Arguments

data

Data frame to use for plot.

x_str

Character string. Name of variable in data to plot on x-axis.

y_str

Character string. Name of variable in data to plot on y-axis.

color_str

Character string (optional). Name of variable in data to use as color aesthetic in plot.

theme_options

(Optional) list of arguments to pass to vthemes::theme_vmodern().

show_plot

Logical. Should this plot be printed? Default FALSE.

...

Other arguments to pass to [ggplot2::geom_line()].

Value

A ggplot line plot.

See also

Other pretty_ggplot_wrappers: plot_bar(), plot_boxplot(), plot_density(), plot_histogram(), plot_point()

Examples

df <- data.frame(time = 1:5, value = 5:9)
plot_line(df, x_str = "time", y_str = "value")

df2 <- data.frame(time = rep(1:5, 2), value = 1:10,
                  group = rep(letters[1:2], each = 5))
plot_line(df2, x_str = "time", y_str = "value", color_str = "group")