jp_plot: Plot the output of a joinpoint analysis.

View source: R/jp_plot.R

jp_plotR Documentation

Plot the output of a joinpoint analysis.

Description

Plot the output of a joinpoint analysis.

Usage

jp_plot(
  jp,
  by_level = NULL,
  legend_pattern = getOption("jp_plot_legend_pattern", "{xmin}-{xmax}: {slope}"),
  title_pattern = getOption("jp_plot_title_pattern", "{key}={val}"),
  ncol = 1,
  return_patchwork = TRUE,
  ...
)

Arguments

jp

A list generated using joinpoint().

by_level

One or several stratification levels. Works only if jp was made using one single stratification variable.

legend_pattern

glue::glue() pattern for the legend. Can use variables slope, xmin, and xmax. Can be set through options, e.g. options(jp_plot_legend_pattern="-{slope}-").

title_pattern

glue::glue() pattern for the title. Can use variables key (grouping variable) and val (current group). Can be set through options, e.g. options(jp_plot_title_pattern="-{val}-").

...

passed on to patchwork::wrap_plots()

Value

a patchwork if return_patchwork==TRUE, a list of ggplots otherwise


DanChaltiel/nih.joinpoint documentation built on Sept. 9, 2024, 4:23 a.m.