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.
apply_scale_mapping(numeric_values, scale_mapping)Vector of category labels
Vector of numeric x positions from built plot data
Named vector mapping positions to labels (e.g., c("1" = "A", "2" = "B"))