R/remove_legend.R

Defines functions remove_legend

Documented in remove_legend

#' remove_legend
#'
#' Remove just the legend from a ggplot2 object.
#'
#' @param ggplot_object a ggplot
#'
#' @return a ggplot without a legend
#'
#' @export
#'
remove_legend <- function(ggplot_object) {

  ggplot_object +
    ggplot2::guides(
      color = FALSE,
      fill = FALSE,
      alpha = FALSE,
      size = FALSE,
      shape = FALSE,
      linetype = FALSE
    )

}
UrbanInstitute/urbnthemes documentation built on Jan. 26, 2022, 8:34 p.m.