R/stat-identity.R

#' @rdname Stat
#' @format NULL
#' @usage NULL
#' @export
StatIdentity <- ggproto(
  "StatIdentity", Stat,
  compute_layer = function(self, data, params, layout) {
    data
  }
)

#' Leave data as is
#'
#' The identity statistic leaves the data unchanged.
#'
#' @inheritParams layer
#' @inheritParams geom_point
#' @export
#' @examples
#' p <- ggplot(mtcars, aes(wt, mpg))
#' p + stat_identity()
stat_identity <- make_constructor(StatIdentity, geom = "point")

Try the ggplot2 package in your browser

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

ggplot2 documentation built on Sept. 11, 2025, 9:10 a.m.