R/relabel_y_axis.R

Defines functions relabel_y_axis

Documented in relabel_y_axis

#' Relabel the Y-Axis of a Dot-Whisker Plot
#'
#' \code{relabel_y_axis} DEPRECATED. A convenience function for relabeling the predictors on the y-axis of a dot-whisker plot created by \code{\link[dotwhisker]{dwplot}}.  It is deprecated; use \code{\link[dotwhisker]{relabel_predictors}} instead.
#'
#' @param x A vector of labels for predictors, listed from top to bottom
#'
#' @returns The function returns an object of the same type as it is passed: a plot generated by \code{\link[dotwhisker]{dwplot}}.
#'
#' @seealso \code{\link[dotwhisker]{relabel_predictors}} to relabel predictors on the y-axis of a dot-whisker plot or in a tidy data.frame
#'
#'
#' @export

relabel_y_axis <- function(x) {
    scale_y_continuous(breaks = length(x):1, labels = x)
}

Try the dotwhisker package in your browser

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

dotwhisker documentation built on June 8, 2025, 1:08 p.m.