Skip to content

Merge RC into master #3366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ visual_test
^appveyor\.yml$
^\.github$
^vignettes/profilings
^cran-comments\.md$
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ matrix:
provider: script
script: Rscript -e 'pkgdown::deploy_site_github(verbose = TRUE)'
skip_cleanup: true
- r: oldrel
- r: 3.5
- r: 3.4
- r: 3.3
- r: 3.2
env: R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
- r: 3.1
env: R_REMOTES_NO_ERRORS_FROM_WARNINGS=true

# environment variables set for all builds
env:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Authors@R: c(
person("RStudio", role = c("cph"))
)
Depends:
R (>= 3.1)
R (>= 3.2)
Imports:
digest,
grDevices,
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(i.e., `slope`, `intercept`, `yintercept`, and/or `xintercept`)
and mapped aesthetics (i.e., `data` and/or `mapping`).

# ggplot2 3.1.1.9000
# ggplot2 3.2.0

This is a minor release with an emphasis on internal changes to make ggplot2
faster and more consistent. The few interface changes will only affect the
Expand All @@ -14,6 +14,9 @@ extension developers if they have relied on internals that have been changed.
This release also sees the addition of Hiroaki Yutani (@yutannihilation) to the
core developer team.

With the release of R 3.6, ggplot2 now requires the R version to be at least 3.2,
as the tidyverse is committed to support 5 major versions of R.

## Breaking changes

* Two patches (#2996 and #3050) fixed minor rendering problems. In most cases,
Expand Down
27 changes: 24 additions & 3 deletions R/compat-plyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,26 @@ rbind_dfs <- function(dfs) {
allocated[new_columns] <- TRUE
if (all(allocated)) break
}
is_date <- lapply(out, inherits, 'Date')
is_time <- lapply(out, inherits, 'POSIXct')
pos <- c(cumsum(nrows) - nrows + 1)
for (i in seq_along(dfs)) {
df <- dfs[[i]]
rng <- seq(pos[i], length.out = nrows[i])
for (col in names(df)) {
if (inherits(df[[col]], 'factor')) {
date_col <- inherits(df[[col]], 'Date')
time_col <- inherits(df[[col]], 'POSIXct')
if (is_date[[col]] && !date_col) {
out[[col]][rng] <- as.Date(
unclass(df[[col]]),
origin = ggplot_global$date_origin
)
} else if (is_time[[col]] && !time_col) {
out[[col]][rng] <- as.POSIXct(
unclass(df[[col]]),
origin = ggplot_global$time_origin
)
} else if (date_col || time_col || inherits(df[[col]], 'factor')) {
out[[col]][rng] <- as.character(df[[col]])
} else {
out[[col]][rng] <- df[[col]]
Expand All @@ -307,7 +321,11 @@ rbind_dfs <- function(dfs) {
for (col in names(col_levels)) {
out[[col]] <- factor(out[[col]], levels = col_levels[[col]])
}
attributes(out) <- list(class = "data.frame", names = names(out), row.names = .set_row_names(total))
attributes(out) <- list(
class = "data.frame",
names = names(out),
row.names = .set_row_names(total)
)
out
}
#' Apply function to unique subsets of a data.frame
Expand All @@ -333,6 +351,7 @@ dapply <- function(df, by, fun, ..., drop = TRUE) {
grouping_cols <- .subset(df, by)
ids <- id(grouping_cols, drop = drop)
group_rows <- split(seq_len(nrow(df)), ids)
fallback_order <- unique(c(by, names(df)))
rbind_dfs(lapply(seq_along(group_rows), function(i) {
cur_data <- df_rows(df, group_rows[[i]])
res <- fun(cur_data, ...)
Expand All @@ -341,6 +360,8 @@ dapply <- function(df, by, fun, ..., drop = TRUE) {
vars <- lapply(setNames(by, by), function(col) .subset2(cur_data, col)[1])
if (is.matrix(res)) res <- split_matrix(res)
if (is.null(names(res))) names(res) <- paste0("V", seq_along(res))
new_data_frame(modify_list(unclass(vars), unclass(res)))
if (all(by %in% names(res))) return(new_data_frame(unclass(res)))
res <- modify_list(unclass(vars), unclass(res))
new_data_frame(res[intersect(c(fallback_order, names(res)), names(res))])
}))
}
23 changes: 2 additions & 21 deletions R/coord-map.r
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,10 @@
#'
#' if (require("maps")) {
#' # Other projections
#' nzmap + coord_map("cylindrical")
#' }
#'
#' if (require("maps")) {
#' nzmap + coord_map("azequalarea", orientation = c(-36.92, 174.6, 0))
#' }
#'
#' if (require("maps")) {
#' nzmap + coord_map("lambert", parameters = c(-37, -44))
#' }
#'
#' if (require("maps")) {
#' states <- map_data("state")
#' usamap <- ggplot(states, aes(long, lat, group = group)) +
#' geom_polygon(fill = "white", colour = "black")
Expand All @@ -83,39 +75,27 @@
#' }
#'
#' if (require("maps")) {
#' usamap + coord_quickmap()
#' }
#'
#' if (require("maps")) {
#' # See ?mapproject for coordinate systems and their parameters
#' usamap + coord_map("gilbert")
#' }
#'
#' if (require("maps")) {
#' usamap + coord_map("lagrange")
#' }
#'
#' if (require("maps")) {
#' # For most projections, you'll need to set the orientation yourself
#' # as the automatic selection done by mapproject is not available to
#' # ggplot
#' usamap + coord_map("orthographic")
#' }
#'
#' if (require("maps")) {
#' usamap + coord_map("stereographic")
#' }
#'
#' if (require("maps")) {
#' usamap + coord_map("conic", lat0 = 30)
#' }
#'
#' if (require("maps")) {
#' usamap + coord_map("bonne", lat0 = 50)
#' }
#'
#' \dontrun{
#' if (require("maps")) {
#'
#' # World map, using geom_path instead of geom_polygon
#' world <- map_data("world")
#' worldmap <- ggplot(world, aes(x = long, y = lat, group = group)) +
Expand All @@ -136,6 +116,7 @@
#' # Centered on New York (currently has issues with closing polygons)
#' worldmap + coord_map("ortho", orientation = c(41, -74, 0))
#' }
#' }
coord_map <- function(projection="mercator", ..., parameters = NULL, orientation = NULL, xlim = NULL, ylim = NULL, clip = "on") {
if (is.null(parameters)) {
params <- list(...)
Expand Down
6 changes: 3 additions & 3 deletions R/position-dodge.r
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#' ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) +
#' geom_bar(position = "dodge2")
#'
#' # By default, dodging with `position_dodge2()` preserves the width of each
#' # element. You can choose to preserve the total width with:
#' # By default, dodging with `position_dodge2()` preserves the total width of
#' # the elements. You can choose to preserve the width of each element with:
#' ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) +
#' geom_bar(position = position_dodge(preserve = "total"))
#' geom_bar(position = position_dodge2(preserve = "single"))
#'
#' \donttest{
#' ggplot(diamonds, aes(price, fill = cut)) +
Expand Down
6 changes: 6 additions & 0 deletions R/zzz.r
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ pathGrob <- NULL

ggplot_global$theme_current <- theme_gray()

# Used by rbind_dfs
date <- Sys.Date()
ggplot_global$date_origin <- date - unclass(date)
time <- Sys.time()
ggplot_global$time_origin <- time - unclass(time)

# To avoid namespace clash with dplyr.
# It seems surprising that this hack works
if (requireNamespace("dplyr", quietly = TRUE)) {
Expand Down
2 changes: 2 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ navbar:
text: News
menu:
- text: "Release notes"
- text: "Version 3.2.0"
href: https://www.tidyverse.org/articles/2019/06/ggplot2-3-2-0/
- text: "Version 3.1.0"
href: https://www.tidyverse.org/articles/2018/10/ggplot2-3-1-0/
- text: "Version 3.0.0"
Expand Down
Loading