plot_discrete: Plot two discrete distributions with overlap

View source: R/plot_discrete.R

plot_discreteR Documentation

Plot two discrete distributions with overlap

Description

Plot two discrete distributions with overlap

Usage

plot_discrete(
  x,
  y,
  support = NULL,
  group_names = c("Group 1", "Group 2"),
  main = "Two-group discrete distributions",
  xlab = "Value",
  ylab = "Proportion",
  col_x = adjustcolor("#2F5FB3", alpha.f = 0.2),
  col_y = adjustcolor("#CC3333", alpha.f = 0.2),
  overlap_col = adjustcolor("grey55", alpha.f = 0.35),
  line_col_x = "#2F5FB3",
  line_col_y = "#CC3333",
  lwd = 2,
  pch = 16,
  cex_pt = 1.1,
  las = 1,
  bar_width = 0.2,
  show_jsd = TRUE,
  jsd_digits = 3,
  na_rm = TRUE
)

Arguments

x

Vector for group 1.

y

Vector for group 2.

support

Optional support values.

group_names

Group labels.

main

Plot title.

xlab

X-axis label.

ylab

Y-axis label.

col_x

Color for group 1.

col_y

Color for group 2.

overlap_col

Fill color for overlap bars.

line_col_x

Line color for group 1.

line_col_y

Line color for group 2.

lwd

Line width.

pch

Point character.

cex_pt

Point size.

las

Axis label style for x-axis.

bar_width

Width of overlap bars.

show_jsd

Logical; whether to display JSD on the plot.

jsd_digits

Number of digits for displayed JSD.

na_rm

Logical; remove missing values?

Value

Invisibly returns plotting data.


jsdtools documentation built on March 31, 2026, 1:06 a.m.