Skip to content

Commit

Permalink
Merge branch 'main' into opt1_theme_classic_update
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand authored Aug 26, 2024
2 parents cd93462 + 3a7ae74 commit 816312d
Show file tree
Hide file tree
Showing 192 changed files with 2,009 additions and 813 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ on:
pull_request:
branches: [main, master]

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
Expand All @@ -25,15 +27,15 @@ jobs:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}
# use 4.0 or 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: 'oldrel-4'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -46,7 +48,7 @@ jobs:
VDIFFR_LOG_PATH: "../vdiffr.Rout.fail"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -62,9 +64,10 @@ jobs:
extra-packages: >
any::rcmdcheck,
Hmisc=?ignore-before-r=4.1.0,
quantreg=?ignore-before-r=4.3.0,
quantreg=?ignore-before-r=4.3.0
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
10 changes: 7 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ on:
types: [published]
workflow_dispatch:

name: pkgdown
name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
Expand All @@ -19,8 +21,10 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -39,7 +43,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
issue_comment:
types: [created]

name: Commands
name: pr-commands.yaml

permissions: read-all

jobs:
document:
Expand All @@ -13,8 +15,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down Expand Up @@ -50,8 +54,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
pull_request:
branches: [main, master]

name: test-coverage
name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
Expand All @@ -15,36 +17,45 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
covr::codecov(
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
13 changes: 4 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,19 @@ Each of these steps are described in more detail below. This might feel
overwhelming the first time you get set up, but it gets easier with practice.
If you get stuck at any point, please reach out for help on the [ggplot2-dev](https://groups.google.com/forum/#!forum/ggplot2-dev) mailing list.

If you're not familiar with git or github, please start by reading <http://r-pkgs.had.co.nz/git.html>
If you're not familiar with git or github, please start by reading <https://r-pkgs.org/software-development-practices.html>

<!--
* [ ] Motivate the change in one paragraph, and include it in NEWS.
In parentheses, reference your github user name and this issue:
`(@hadley, #1234)`
* [ ] Check pull request only includes relevant changes.
* [ ] Use the [official style](http://adv-r.had.co.nz/Style.html).
* [ ] Use the [official style](https://style.tidyverse.org).
* [ ] Update documentation and re-run roxygen2
* [ ] Add test, if bug in non-graphical function
* [ ] Add visual test, if bug in graphical function
* [ ] Add minimal example, if new graphical feature
See http://docs.ggplot2.org/dev/vignettes/development.html for more details.
--->

Pull requests will be evaluated against a seven point checklist:
Expand All @@ -100,20 +99,16 @@ Pull requests will be evaluated against a seven point checklist:
and don't submit any others until the first one has been processed.

1. __Use ggplot2 coding style__. Please follow the
[official tidyverse style](http://style.tidyverse.org). Maintaining
[official tidyverse style](https://style.tidyverse.org). Maintaining
a consistent style across the whole code base makes it much easier to
jump into the code. If you're modifying existing ggplot2 code that
doesn't follow the style guide, a separate pull request to fix the
style would be greatly appreciated.

1. If you're adding new parameters or a new function, you'll also need
to document them with [roxygen](https://github.com/klutometis/roxygen).
to document them with [roxygen2](https://github.com/r-lib/roxygen2).
Make sure to re-run `devtools::document()` on the code before submitting.

Currently, ggplot2 uses the development version of roxygen2, which you
can get with `install_github("klutometis/roxygen")`. This will be
available on CRAN in the near future.

1. If fixing a bug or adding a new feature to a non-graphical function,
please add a [testthat](https://github.com/r-lib/testthat) unit test.

Expand Down
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Depends:
R (>= 3.5)
Imports:
cli,
glue,
grDevices,
grid,
gtable (>= 0.1.1),
Expand Down Expand Up @@ -79,7 +78,7 @@ Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Collate:
'ggproto.R'
'ggplot-global.R'
Expand Down
5 changes: 3 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ export(get_last_plot)
export(get_layer_data)
export(get_layer_grob)
export(get_panel_scales)
export(get_strip_labels)
export(get_theme)
export(gg_dep)
export(gg_par)
Expand Down Expand Up @@ -512,6 +513,8 @@ export(remove_missing)
export(render_axes)
export(render_strips)
export(replace_theme)
export(reset_geom_defaults)
export(reset_stat_defaults)
export(reset_theme_settings)
export(resolution)
export(scale_alpha)
Expand Down Expand Up @@ -727,8 +730,6 @@ import(gtable)
import(rlang)
import(scales)
import(vctrs)
importFrom(glue,glue)
importFrom(glue,glue_collapse)
importFrom(grid,arrow)
importFrom(grid,unit)
importFrom(lifecycle,deprecated)
Expand Down
54 changes: 52 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
# ggplot2 (development version)

* `theme_classic()` now has black ticks and text instead of dark gray. In
addition, `theme_classic()`'s axis line end is `"square"` (@teunbrand, #5978).
* New `reset_geom_defaults()` and `reset_stat_defaults()` to restore all geom or
stat default aesthetics at once (@teunbrand, #5975).
* `facet_wrap()` can have `space = "free_x"` with 1-row layouts and
`space = "free_y"` with 1-column layouts (@teunbrand)
* Secondary axes respect `n.breaks` setting in continuous scales (@teunbrand, #4483).
* Layers can have names (@teunbrand, #4066).
* (internal) improvements to `pal_qualitative()` (@teunbrand, #5013)
* `coord_radial(clip = "on")` clips to the panel area when the graphics device
supports clipping paths (@teunbrand, #5952).
* (internal) Panel clipping responsibility moved from Facet class to Coord
class through new `Coord$draw_panel()` method.
* `theme(strip.clip)` now defaults to `"on"` and is independent of Coord
clipping (@teunbrand, 5952).
* (internal) rearranged the code of `Facet$draw_paensl()` method (@teunbrand).
* Axis labels are now justified across facet panels (@teunbrand, #5820)
* Fixed bug in `stat_function()` so x-axis title now produced automatically
when no data added. (@phispu, #5647).
* geom_sf now accepts shape names (@sierrajohnson, #5808)
* Added `gg` class to `labs()` (@phispu, #5553).
* Missing values from discrete palettes are no longer translated
(@teunbrand, #5929).
* Fixed bug in `facet_grid(margins = TRUE)` when using expresssions
(@teunbrand, #1864).
* `geom_step()` now supports the `orientation` argument (@teunbrand, #5936).
* `position_dodge()` and `position_jitterdodge()` now have a `reverse` argument
(@teunbrand, #3610)
* `coord_radial(r.axis.inside)` can now take a numeric value to control
placement of internally placed radius axes (@teunbrand, #5805).
* (internal) default labels are derived in `ggplot_build()` rather than
in `ggplot_add.Layer()` (@teunbrand, #5894)
* An attempt is made to use a variable's label attribute as default label
(@teunbrand, #4631)
* Themes gain an additional `header_family` argument to easily set the font
for headers and titles (#5886).
* The `plot.subtitle`, `plot.caption` and `plot.tag` theme elements now inherit
from the root `text` element instead of the `title` element (#5886).
* ggplot2 no longer imports {glue} (@teunbrand, #5986).
* `geom_rect()` can now derive the required corners positions from `x`/`width`
or `y`/`height` parameterisation (@teunbrand, #5861).
* All position scales now use the same definition of `x` and `y` aesthetics.
This lets uncommon aesthetics like `xintercept` expand scales as usual.
(#3342, #4966, @teunbrand)
Expand Down Expand Up @@ -106,8 +143,21 @@
the `nbin` argument (@teunbrand, #5882, #5036)
* `after_stat()` and `after_scale()` throw warnings when the computed aesthetics
are not of the correct length (#5901).
* `guide_colourbar()` now correctly hands off `position` and `available_aes`
parameters downstream (@teunbrand, #5930)
* `geom_hline()` and `geom_vline()` now have `position` argument
(@yutannihilation, #4285).
* New function `get_strip_labels()` to retrieve facet labels (@teunbrand, #4979)
* Fixed bug in `position_dodge2()`'s identification of range overlaps
(@teunbrand, #5938, #4327).
* Fixed bug where empty discrete scales weren't recognised as such
(@teunbrand, #5945).
* (internal) The summary function of `stat_summary()` and `stat_summary_bin()`
is setup once in total instead of once per group (@teunbrand, #5971)
* `facet_grid(space = "free")` can now be combined with `coord_fixed()`
(@teunbrand, #4584).
* `theme_classic()` now has black ticks and text instead of dark gray. In
addition, `theme_classic()`'s axis line end is `"square"` (@teunbrand, #5978).

# ggplot2 3.5.1

Expand Down
8 changes: 4 additions & 4 deletions R/aes-evaluation.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ is_calculated <- function(x, warn = FALSE) {
} else if (is.symbol(x)) {
res <- is_dotted_var(as.character(x))
if (res && warn) {
what <- I(glue("The dot-dot notation (`{x}`)"))
what <- I(paste0("The dot-dot notation (`", x, "`)"))
var <- gsub(match_calculated_aes, "\\1", as.character(x))
with <- I(glue("`after_stat({var})`"))
with <- I(paste0("`after_stat(", var, ")`"))
deprecate_warn0("3.4.0", what, with, id = "ggplot-warn-aes-dot-dot")
}
res
Expand All @@ -242,9 +242,9 @@ is_calculated <- function(x, warn = FALSE) {
} else if (is.call(x)) {
if (identical(x[[1]], quote(stat))) {
if (warn) {
what <- I(glue("`{expr_deparse(x)}`"))
what <- I(paste0("`", expr_deparse(x), "`"))
x[[1]] <- quote(after_stat)
with <- I(glue("`{expr_deparse(x)}`"))
with <- I(paste0("`", expr_deparse(x), "`"))
deprecate_warn0("3.4.0", what, with, id = "ggplot-warn-aes-stat")
}
TRUE
Expand Down
6 changes: 3 additions & 3 deletions R/annotation-logticks.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,

names(xticks)[names(xticks) == "value"] <- x_name # Rename to 'x' for coordinates$transform
xticks <- coord$transform(xticks, panel_params)
xticks = xticks[xticks$x <= 1 & xticks$x >= 0,]
xticks <- xticks[xticks$x <= 1 & xticks$x >= 0,]

if (outside)
xticks$end = -xticks$end
Expand Down Expand Up @@ -203,7 +203,7 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,

names(yticks)[names(yticks) == "value"] <- y_name # Rename to 'y' for coordinates$transform
yticks <- coord$transform(yticks, panel_params)
yticks = yticks[yticks$y <= 1 & yticks$y >= 0,]
yticks <- yticks[yticks$y <= 1 & yticks$y >= 0,]

if (outside)
yticks$end = -yticks$end
Expand Down Expand Up @@ -238,7 +238,7 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
# - start: on the other axis, start position of the line (usually 0)
# - end: on the other axis, end position of the line (for example, .1, .2, or .3)
calc_logticks <- function(base = 10, ticks_per_base = base - 1,
minpow = 0, maxpow = minpow + 1, start = 0, shortend = .1, midend = .2, longend = .3) {
minpow = 0, maxpow = minpow + 1, start = 0, shortend = 0.1, midend = 0.2, longend = 0.3) {

# Number of blocks of tick marks
reps <- maxpow - minpow
Expand Down
Loading

0 comments on commit 816312d

Please sign in to comment.