R/guide-none.R

Defines functions guide_none

Documented in guide_none

#' @include layer.R
NULL

#' Empty guide
#'
#' This guide draws nothing.
#'
#' @inheritParams guide_axis
#'
#' @export
#'
guide_none <- function(title = waiver(), position = waiver()) {
  new_guide(
    title = title,
    position = position,
    available_aes = "any",
    super = GuideNone
  )
}

#' @rdname ggplot2-ggproto
#' @format NULL
#' @usage NULL
#' @export
GuideNone <- ggproto(
  "GuideNone", Guide,

  # Perform no training
  train = function(self, params = self$params, scale, aesthetic = NULL, ...) {
    params
  },

  transform = function(self, params, coord, ...) {
    params
  },

  # Draw nothing
  draw = function(self, ...) {
    zeroGrob()
  }
)

Try the ggplot2 package in your browser

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

ggplot2 documentation built on June 22, 2024, 11:35 a.m.