Color axis labels

map_axis_labels(
  plt,
  label_data_x = NULL,
  label_data_y = NULL,
  aes_label,
  scale = ggplot2::scale_color_hue(aesthetics = "axis_color")
)

Arguments

plt

ggplot2::ggplot() object

label_data_x

data.frame() containing the mapping between x-axis labels and aes_label

label_data_y

data.frame() containing the mapping between y-axis labels and aes_label

aes_label

character or bare symbol giving the column in label_data to be mapped

scale

ggplot2 discrete color

Value

plt with axis text modified

Examples

require(ggplot2)
require(dplyr)
plt = ggplot(mpg, aes(x = manufacturer, y = drv)) + geom_jitter()
label_data = mpg %>% select(manufacturer) %>% unique() %>%
mutate(euro = manufacturer %in% c('audi', 'volkswagen'))
map_axis_labels(plt, label_data_x = label_data, aes_label = euro)