Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ggplot2 (development version)

* Deprecated functions and arguments prior to ggplot2 3.0.0 throw errors instead
of warnings.
* Functions and arguments that were soft-deprecated up to ggplot2 3.2.0 now
throw warnings.
* Fixed bug where the `ggplot2::`-prefix did not work with `stage()`
(@teunbrand, #6104).
* New `get_labs()` function for retrieving completed plot labels
Expand Down
28 changes: 3 additions & 25 deletions R/aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
#'
#' @export
aes_ <- function(x, y, ...) {
deprecate_soft0(
deprecate_warn0(
"3.0.0",
"aes_()",
details = "Please use tidy evaluation idioms with `aes()`"
Expand All @@ -310,7 +310,7 @@
#' @rdname aes_
#' @export
aes_string <- function(x, y, ...) {
deprecate_soft0(
deprecate_warn0(
"3.0.0",
"aes_string()",
details = c(
Expand Down Expand Up @@ -367,29 +367,7 @@
#' @keywords internal
#' @export
aes_auto <- function(data = NULL, ...) {
deprecate_warn0("2.0.0", "aes_auto()")

# detect names of data
if (is.null(data)) {
cli::cli_abort("{.fn aes_auto} requires a {.cls data.frame} or names of data.frame.")
} else if (is.data.frame(data)) {
vars <- names(data)
} else {
vars <- data
}

# automatically detected aes
vars <- intersect(ggplot_global$all_aesthetics, vars)
names(vars) <- vars
aes <- lapply(vars, function(x) parse(text = x)[[1]])

# explicitly defined aes
if (length(match.call()) > 2) {
args <- as.list(match.call()[-1])
aes <- c(aes, args[names(args) != "data"])
}

structure(rename_aes(aes), class = "uneval")
lifecycle::deprecate_stop("2.0.0", "aes_auto()")

Check warning on line 370 in R/aes.R

View check run for this annotation

Codecov / codecov/patch

R/aes.R#L370

Added line #L370 was not covered by tests
}

mapped_aesthetics <- function(x) {
Expand Down
2 changes: 1 addition & 1 deletion R/annotation-custom.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ GeomCustomAnn <- ggproto("GeomCustomAnn", Geom,
editGrob(grob, vp = vp, name = paste(grob$name, annotation_id()))
},

default_aes = aes_(xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
default_aes = aes(xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
)

annotation_id <- local({
Expand Down
5 changes: 2 additions & 3 deletions R/facet-grid-.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@
switch = NULL, drop = TRUE, margins = FALSE,
axes = "margins", axis.labels = "all",
facets = deprecated()) {
# `facets` is deprecated and renamed to `rows`
# `facets` is deprecated
if (lifecycle::is_present(facets)) {
deprecate_warn0("2.2.0", "facet_grid(facets)", "facet_grid(rows)")
rows <- facets
lifecycle::deprecate_stop("2.2.0", "facet_grid(facets)", "facet_grid(rows)")

Check warning on line 137 in R/facet-grid-.R

View check run for this annotation

Codecov / codecov/patch

R/facet-grid-.R#L137

Added line #L137 was not covered by tests
}

# Should become a warning in a future release
Expand Down
5 changes: 3 additions & 2 deletions R/facet-wrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@
facets <- compact_facets(facets)

if (lifecycle::is_present(switch) && !is.null(switch)) {
deprecate_warn0("2.2.0", "facet_wrap(switch)", "facet_wrap(strip.position)")
strip.position <- if (switch == "x") "bottom" else "left"
lifecycle::deprecate_stop(
"2.2.0", "facet_wrap(switch)", "facet_wrap(strip.position)"
)

Check warning on line 185 in R/facet-wrap.R

View check run for this annotation

Codecov / codecov/patch

R/facet-wrap.R#L183-L185

Added lines #L183 - L185 were not covered by tests
}
strip.position <- arg_match0(strip.position, c("top", "bottom", "left", "right"))

Expand Down
2 changes: 1 addition & 1 deletion R/fortify-map.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@
borders <- function(database = "world", regions = ".", fill = NA,
colour = "grey50", xlim = NULL, ylim = NULL, ...) {
df <- map_data(database, regions, xlim = xlim, ylim = ylim)
geom_polygon(aes_(~long, ~lat, group = ~group), data = df,
geom_polygon(aes(.data$long, .data$lat, group = .data$group), data = df,

Check warning on line 136 in R/fortify-map.R

View check run for this annotation

Codecov / codecov/patch

R/fortify-map.R#L136

Added line #L136 was not covered by tests
fill = fill, colour = colour, ..., inherit.aes = FALSE)
}
3 changes: 1 addition & 2 deletions R/geom-spoke.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
#' @rdname geom_spoke
#' @usage NULL
stat_spoke <- function(...) {
deprecate_warn0("2.0.0", "stat_spoke()", "geom_spoke()")
geom_spoke(...)
lifecycle::deprecate_stop("2.0.0", "stat_spoke()", "geom_spoke()")

Check warning on line 50 in R/geom-spoke.R

View check run for this annotation

Codecov / codecov/patch

R/geom-spoke.R#L50

Added line #L50 was not covered by tests
}

#' @rdname ggplot2-ggproto
Expand Down
2 changes: 1 addition & 1 deletion R/labeller.R
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@
keep.as.numeric = deprecated(), .multi_line = TRUE,
.default = label_value) {
if (lifecycle::is_present(keep.as.numeric)) {
deprecate_warn0("2.0.0", "labeller(keep.as.numeric)")
lifecycle::deprecate_stop("2.0.0", "labeller(keep.as.numeric)")

Check warning on line 414 in R/labeller.R

View check run for this annotation

Codecov / codecov/patch

R/labeller.R#L414

Added line #L414 was not covered by tests
}
dots <- list2(...)
.default <- as_labeller(.default)
Expand Down
6 changes: 3 additions & 3 deletions R/layer.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@

# Handle show_guide/show.legend
if (!is.null(params$show_guide)) {
deprecate_warn0("2.0.0", "layer(show_guide)", "layer(show.legend)", user_env = user_env)
show.legend <- params$show_guide
params$show_guide <- NULL
lifecycle::deprecate_stop(
"2.0.0", "layer(show_guide)", "layer(show.legend)"
)

Check warning on line 115 in R/layer.R

View check run for this annotation

Codecov / codecov/patch

R/layer.R#L113-L115

Added lines #L113 - L115 were not covered by tests
}

# we validate mapping before data because in geoms and stats
Expand Down
9 changes: 4 additions & 5 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,17 @@ plot_clone <- function(plot) {
#' @export
#' @method print ggplot
#' @examples
#' colours <- list(~class, ~drv, ~fl)
#' colours <- c("class", "drv", "fl")
#'
#' # Doesn't seem to do anything!
#' for (colour in colours) {
#' ggplot(mpg, aes_(~ displ, ~ hwy, colour = colour)) +
#' ggplot(mpg, aes(displ, hwy, colour = .data[[colour]])) +
#' geom_point()
#' }
#'
#' # Works when we explicitly print the plots
#' for (colour in colours) {
#' print(ggplot(mpg, aes_(~ displ, ~ hwy, colour = colour)) +
#' geom_point())
#' print(ggplot(mpg, aes(displ, hwy, colour = .data[[colour]])) +
#' geom_point())
#' }
print.ggplot <- function(x, newpage = is.null(vp), vp = NULL, ...) {
set_last_plot(x)
Expand Down
11 changes: 3 additions & 8 deletions R/stat-bin.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,13 @@ StatBin <- ggproto("StatBin", Stat,
}

if (!is.null(params$drop)) {
deprecate_warn0("2.1.0", "stat_bin(drop)", "stat_bin(pad)")
params$drop <- NULL
lifecycle::deprecate_stop("2.1.0", "stat_bin(drop)", "stat_bin(pad)")
}
if (!is.null(params$origin)) {
deprecate_warn0("2.1.0", "stat_bin(origin)", "stat_bin(boundary)")
params$boundary <- params$origin
params$origin <- NULL
lifecycle::deprecate_stop("2.1.0", "stat_bin(origin)", "stat_bin(boundary)")
}
if (!is.null(params$right)) {
deprecate_warn0("2.1.0", "stat_bin(right)", "stat_bin(closed)")
params$closed <- if (params$right) "right" else "left"
params$right <- NULL
lifecycle::deprecate_stop("2.1.0", "stat_bin(right)", "stat_bin(closed)")
}
if (!is.null(params$boundary) && !is.null(params$center)) {
cli::cli_abort("Only one of {.arg boundary} and {.arg center} may be specified in {.fn {snake_class(self)}}.")
Expand Down
15 changes: 4 additions & 11 deletions R/theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -456,32 +456,25 @@
elements <- find_args(..., complete = NULL, validate = NULL)

if (!is.null(elements$axis.ticks.margin)) {
deprecate_warn0(
lifecycle::deprecate_stop(

Check warning on line 459 in R/theme.R

View check run for this annotation

Codecov / codecov/patch

R/theme.R#L459

Added line #L459 was not covered by tests
"2.0.0", "theme(axis.ticks.margin)",
details = "Please set `margin` property of `axis.text` instead"
)
elements$axis.ticks.margin <- NULL
}
if (!is.null(elements$panel.margin)) {
deprecate_warn0(
lifecycle::deprecate_stop(

Check warning on line 465 in R/theme.R

View check run for this annotation

Codecov / codecov/patch

R/theme.R#L465

Added line #L465 was not covered by tests
"2.2.0", "theme(panel.margin)", "theme(panel.spacing)"
)
elements$panel.spacing <- elements$panel.margin
elements$panel.margin <- NULL
}
if (!is.null(elements$panel.margin.x)) {
deprecate_warn0(
lifecycle::deprecate_stop(

Check warning on line 470 in R/theme.R

View check run for this annotation

Codecov / codecov/patch

R/theme.R#L470

Added line #L470 was not covered by tests
"2.2.0", "theme(panel.margin.x)", "theme(panel.spacing.x)"
)
elements$panel.spacing.x <- elements$panel.margin.x
elements$panel.margin.x <- NULL
}
if (!is.null(elements$panel.margin.y)) {
deprecate_warn0(
lifecycle::deprecate_stop(

Check warning on line 475 in R/theme.R

View check run for this annotation

Codecov / codecov/patch

R/theme.R#L475

Added line #L475 was not covered by tests
"2.2.0", "theme(panel.margin.y)", "theme(panel.spacing.y)"
)
elements$panel.spacing.y <- elements$panel.margin.y
elements$panel.margin.y <- NULL
}
if (is.unit(elements$legend.margin) && !is.margin(elements$legend.margin)) {
cli::cli_warn(c(
Expand Down
9 changes: 4 additions & 5 deletions man/print.ggplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading