R/bump-aes-labels.R

Defines functions bump_aes_labels

bump_aes_labels <- function(labels, original_aes, new_aes) {
  for (l in seq_along(labels)) {
    if (is_protected(labels[[l]], original_aes)) {
      next
    }

    if (names(labels)[[l]] == original_aes) {
      names(labels)[[l]] <- new_aes
      labels[[l]] <- protect(labels[[l]], original_aes)
    }
  }

  labels
}

Try the ggnewscale package in your browser

Any scripts or data that you put into this service are public.

ggnewscale documentation built on Sept. 11, 2024, 9:12 p.m.