show_cutoffs: Add Cutoff Markers to a Histogram

View source: R/show_cutoffs.R

show_cutoffsR Documentation

Add Cutoff Markers to a Histogram

Description

[Experimental]

Usage

show_cutoffs(plot, color = "#1e3a8a", size = 4, labels = FALSE)

Arguments

plot

A ggplot histogram with fill mapped to a distribution part function, e.g., fill = ~middle(Thumb, .95).

color

Marker/line color. Default "#1e3a8a".

size

Marker size. Default 4.

labels

Whether to add text annotations explaining the cutoffs. Default FALSE.

Details

Adds downward-pointing triangle markers at the empirical quantile cutoffs on a histogram that uses a distribution part function (middle(), tails(), upper(), lower(), or outer()) in its fill aesthetic.

Value

A ggplot object with cutoff markers and optional labels.

Examples

gf_histogram(~Thumb, data = Fingers, fill = ~middle(Thumb, .95)) %>%
  show_cutoffs(labels = TRUE)

coursekata documentation built on March 11, 2026, 1:06 a.m.