Rename axis or color labels
Usage
rename_x_axis_labels(plot, new_names)
rename_y_axis_labels(plot, new_names)
rename_color_labels(plot, new_names)
Arguments
- plot
A
tidyplot
generated with the functiontidyplot()
.- new_names
Named character vector in the format c("old1" = "new1", "old2" = "new2").
Examples
# Before adjustments
study %>%
tidyplot(x = treatment, y = score) %>%
add_data_points() %>%
add_mean_bar(alpha = 0.4) %>%
add_sem_errorbar()
# Rename x-axis labels
study %>%
tidyplot(x = treatment, y = score) %>%
add_data_points() %>%
add_mean_bar(alpha = 0.4) %>%
add_sem_errorbar() %>%
rename_x_axis_labels(new_names = c(
"A" = "This",
"B" = "is",
"C" = "totally",
"D" = "new"))
# Before adjustments
study %>%
tidyplot(x = score, y = treatment) %>%
add_data_points() %>%
add_mean_bar(alpha = 0.4) %>%
add_sem_errorbar()
# Rename y-axis labels
study %>%
tidyplot(x = score, y = treatment) %>%
add_data_points() %>%
add_mean_bar(alpha = 0.4) %>%
add_sem_errorbar() %>%
rename_y_axis_labels(new_names = c(
"A" = "This",
"B" = "is",
"C" = "totally",
"D" = "new"))
# Before adjustment
study %>%
tidyplot(x = group, y = score, color = dose) %>%
add_data_points() %>%
add_mean_bar(alpha = 0.4) %>%
add_sem_errorbar()
# Rename color labels
study %>%
tidyplot(x = group, y = score, color = dose) %>%
add_data_points() %>%
add_mean_bar(alpha = 0.4) %>%
add_sem_errorbar() %>%
rename_color_labels(new_names = c(
"high" = "Sky high",
"low" = "Deep low"))