reorder_x_axis_labels: Reorder axis or color labels

reorder_x_axis_labelsR Documentation

Reorder axis or color labels

Description

Reorder axis or color labels

Usage

reorder_x_axis_labels(plot, ...)

reorder_y_axis_labels(plot, ...)

reorder_color_labels(plot, ...)

Arguments

plot

A tidyplot generated with the function tidyplot().

...

Arguments passed on to forcats::fct_relevel().

Value

A tidyplot object.

Examples

# Before adjustments
study |>
  tidyplot(x = treatment, y = score) |>
  add_data_points() |>
  add_mean_bar(alpha = 0.4) |>
  add_sem_errorbar()

# Reorder x-axis labels
study |>
  tidyplot(x = treatment, y = score) |>
  add_data_points() |>
  add_mean_bar(alpha = 0.4) |>
  add_sem_errorbar() |>
  reorder_x_axis_labels("D", "B", "A")

# Before adjustments
study |>
  tidyplot(x = score, y = treatment) |>
  add_data_points() |>
  add_mean_bar(alpha = 0.4) |>
  add_sem_errorbar()

# Reorder y-axis labels
study |>
  tidyplot(x = score, y = treatment) |>
  add_data_points() |>
  add_mean_bar(alpha = 0.4) |>
  add_sem_errorbar() |>
  reorder_y_axis_labels("D", "B", "A")

# Before adjustment
study |>
  tidyplot(x = group, y = score, color = dose) |>
  add_data_points() |>
  add_mean_bar(alpha = 0.4) |>
  add_sem_errorbar()

# Reorder color labels
study |>
  tidyplot(x = group, y = score, color = dose) |>
  add_data_points() |>
  add_mean_bar(alpha = 0.4) |>
  add_sem_errorbar() |>
  reorder_color_labels("low")


tidyplots documentation built on April 3, 2025, 9:33 p.m.