R/s3-ggplot2-CoordPolar.R

Defines functions .cstr_construct.CoordPolar.coord_polar .cstr_construct.CoordPolar.environment is_corrupted_CoordPolar .cstr_construct.CoordPolar opts_CoordPolar

Documented in opts_CoordPolar

#' @export
#' @rdname other-opts
opts_CoordPolar <- function(constructor = c("coord_polar", "next", "environment"), ...) {
  .cstr_options("CoordPolar", constructor = constructor[[1]], ...)
}

#' @export
#' @method .cstr_construct CoordPolar
.cstr_construct.CoordPolar <- function(x, ...) {
  opts <- list(...)$opts$CoordPolar %||% opts_CoordPolar()
  if (is_corrupted_CoordPolar(x) || opts$constructor == "next") return(NextMethod())
  UseMethod(".cstr_construct.CoordPolar", structure(NA, class = opts$constructor))
}

is_corrupted_CoordPolar <- function(x) {
  # TODO
  FALSE
}

#' @export
#' @method .cstr_construct.CoordPolar environment
.cstr_construct.CoordPolar.environment <- function(x, ...) {
  .cstr_construct.environment(x, ...)
}

#' @export
#' @method .cstr_construct.CoordPolar coord_polar
.cstr_construct.CoordPolar.coord_polar <- function(x, ...) {
  args <- list(
    theta = x$theta,
    start = x$start,
    direction = x$direction,
    clip = x$clip
  )
  args <- keep_only_non_defaults(args, ggplot2::coord_polar)
  .cstr_apply(args, "ggplot2::coord_polar", ...)
}

Try the constructive package in your browser

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

constructive documentation built on April 3, 2025, 9:39 p.m.