Skip to content

Commit

Permalink
use tidy eval idioms to replace old idioms
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 15, 2024
1 parent 3e7155f commit edb9c45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
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 @@ map_data <- function(map, region = ".", exact = FALSE, ...) {
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)
}
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
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.

0 comments on commit edb9c45

Please sign in to comment.