xplot_binned: Generic binned trend plotting function

View source: R/xplot_binned.R

xplot_binnedR Documentation

Generic binned trend plotting function

Description

Following the xpose design pattern, this is a generic template (analogous to xplot_boxplot() or xplot_pairs()) for rendering already-summarized/binned data as connected points and/or lines across a (typically discrete, possibly ordered) x variable. It is not tied to any particular binning or summarization logic – callers are expected to shape their data (eg via opt's post_processing) and build a named implementation on top of it (eg catdv_vs_occ()) rather than calling it directly for everyday use.

Usage

xplot_binned(
  xpdb,
  mapping = NULL,
  group = "variable",
  type = "pl",
  xscale = "discrete",
  yscale = "continuous",
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  tag = NULL,
  plot_name = "binned",
  gg_theme,
  xp_theme,
  opt,
  quiet,
  ...
)

Arguments

xpdb

<xp_xtras> or <xpose_data> object

mapping

ggplot2 style mapping. Expected to include at least x and y.

group

Column name distinguishing multiple summarized series (eg a variable column). Points/lines/smooths are both connected and coloured by this column (see xpose::xplot_scatter() for the same connecting-line convention).

type

String setting the type of plot to be used: point p, line l, and smooth s, or any combination thereof.

xscale

Defaults to discrete.

yscale

Defaults to continuous.

title

Plot title

subtitle

Plot subtitle

caption

Plot caption

tag

Plot tag

plot_name

Metadata name of plot

gg_theme

As in xpose

xp_theme

As in xpose

opt

Processing options for fetched data

quiet

Silence extra debugging output

...

Additional aesthetics, passed to the point, line and smooth layers.

Details

Unlike xpose::xplot_scatter()'s raw per-subject spaghetti plots, xplot_binned() assumes the supplied data is already one row per x/group combination (eg per occasion, per series) – it does no binning, aggregation, or tidying of its own.

Value

The desired plot


xpose.xtras documentation built on Sept. 1, 2026, 5:08 p.m.