Learn R Programming

maidr (version 0.1.2)

apply_scale_mapping: Apply scale mapping to convert numeric positions to category labels

Description

In faceted plots, ggplot2 converts categorical x-values to numeric positions (1, 2, 3, ...) for efficiency. This function converts them back to the original category labels using the scale mapping.

Usage

apply_scale_mapping(numeric_values, scale_mapping)

Value

Vector of category labels

Arguments

numeric_values

Vector of numeric x positions from built plot data

scale_mapping

Named vector mapping positions to labels (e.g., c("1" = "A", "2" = "B"))