Skip to content

Commit

Permalink
Update based on the upcoming ggplot2 version
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Jan 18, 2024
1 parent 39c4f79 commit b31d0b7
Show file tree
Hide file tree
Showing 128 changed files with 3,847 additions and 644 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@
^CONTRIBUTING\.md$
^\.lintr$
^vignettes/welcome\.Rmd\.orig$
^Rplots\.pdf$
61 changes: 61 additions & 0 deletions .github/workflows/check-ggplot2-devel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
schedule:
- cron: '00 12 * * 1,4'
workflow_dispatch:

name: R-CMD-check-ggplot2-devel

jobs:
R-CMD-check-ggplot2-devel:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release'}


env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: ggplot-devel
extra-packages: |
any::rcmdcheck
needs: check

- name: Install ggplot2 from runiverse
run: |
# Install ggplot2 from rspatial runiverse
install.packages('ggplot2', repos = c('https://tidyverse.r-universe.dev', 'https://cloud.r-project.org'))
# Display version
cat(as.character(packageVersion("ggplot2")))
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ cran-comments.md
/doc/
/Meta/
.Rdata
Rplots.pdf
5 changes: 4 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "tidyterra" in publications use:'
type: software
license: MIT
title: 'tidyterra: ''tidyverse'' Methods and ''ggplot2'' Helpers for ''terra'' Objects'
version: 0.5.1
version: 0.5.1.9000
doi: 10.21105/joss.05751
abstract: Extension of the 'tidyverse' for 'SpatRaster' and 'SpatVector' objects of
the 'terra' package. It includes also new 'geom_' functions that provide a convenient
Expand Down Expand Up @@ -156,6 +156,9 @@ references:
- family-names: Dunnington
given-names: Dewey
orcid: https://orcid.org/0000-0002-9415-4582
- family-names: van den Brand
given-names: Teun
orcid: https://orcid.org/0000-0002-9335-7468
year: '2024'
version: '>= 3.1.0'
- type: software
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tidyterra
Title: 'tidyverse' Methods and 'ggplot2' Helpers for 'terra' Objects
Version: 0.5.1
Version: 0.5.1.9000
Authors@R: c(
person("Diego", "Hernangómez", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8457-4658")),
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# tidyterra (development version)

- Adapt tests to **ggplot2** 3.5.0 (#129) @teunbrand.
- Reduce package size, specially relevant in the external raster `asia.tif`.

# tidyterra 0.5.1

- Adjust tests for `as_sf()` (#124).


# tidyterra 0.5.0

**tidyterra** has been accepted on JOSS. Please use the result of
Expand Down
10 changes: 2 additions & 8 deletions R/scales_cross_blended.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,10 @@
#' palette = "warm_humid",
#' labels = scales::label_number(),
#' breaks = c(-10000, 0, 5000, 8000),
#' guide = guide_colorbar(
#' direction = "horizontal",
#' title.position = "top",
#' barwidth = 25
#' )
#' guide = guide_colorbar(reverse = TRUE)
#' ) +
#' labs(fill = "elevation (m)") +
#' theme_minimal() +
#' theme(legend.position = "bottom")
#'
#' theme_minimal()
#'
#' # Binned
#' ggplot() +
Expand Down
9 changes: 2 additions & 7 deletions R/scales_hypso.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,10 @@
#' palette = "etopo1",
#' labels = scales::label_number(),
#' breaks = c(-10000, 0, 5000, 8000),
#' guide = guide_colorbar(
#' direction = "horizontal",
#' title.position = "top",
#' barwidth = 25
#' )
#' guide = guide_colorbar(reverse = TRUE)
#' ) +
#' labs(fill = "elevation (m)") +
#' theme_minimal() +
#' theme(legend.position = "bottom")
#' theme_minimal()
#'
#'
#' # Binned
Expand Down
12 changes: 2 additions & 10 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,12 @@ ggplot() +
labels = scales::label_number(),
# Further refinements
breaks = c(-10000, -5000, 0, 2000, 5000, 8000),
guide = guide_colorbar(
direction = "horizontal",
nrow = 1,
title.position = "top",
barwidth = 20,
ticks.colour = "black",
ticks.linewidth = 0.3
)
guide = guide_colorbar(reverse = TRUE)
) +
labs(
fill = "elevation (m)",
title = "Hypsometric map of Asia"
) +
theme(legend.position = "bottom")
)
```

### SpatVectors
Expand Down
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ objects with [{ggplot2}](https://ggplot2.tidyverse.org/).

## Overview

You can have a look to the documentation of the dev version in
<https://dieghernan.github.io/tidyterra/dev/>

{tidyverse} methods implemented on {tidyterra} works differently
depending on the type of Spat\* object:

Expand Down Expand Up @@ -248,20 +251,12 @@ ggplot() +
labels = scales::label_number(),
# Further refinements
breaks = c(-10000, -5000, 0, 2000, 5000, 8000),
guide = guide_colorbar(
direction = "horizontal",
nrow = 1,
title.position = "top",
barwidth = 20,
ticks.colour = "black",
ticks.linewidth = 0.3
)
guide = guide_colorbar(reverse = TRUE)
) +
labs(
fill = "elevation (m)",
title = "Hypsometric map of Asia"
) +
theme(legend.position = "bottom")
)
```

<img src="https://raw.githubusercontent.com/dieghernan/tidyterra/main/img/README-hypso-2.png" width="100%" />
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/dieghernan/tidyterra",
"issueTracker": "https://github.com/dieghernan/tidyterra/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.5.1",
"version": "0.5.1.9000",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -308,7 +308,7 @@
"SystemRequirements": null
},
"keywords": ["r", "terra", "ggplot-extension", "r-spatial", "rspatial", "r-package", "rstats", "rstats-package", "cran", "cran-r"],
"fileSize": "3440.712KB",
"fileSize": "2732.419KB",
"citation": [
{
"@type": "ScholarlyArticle",
Expand Down
15 changes: 6 additions & 9 deletions data-raw/asia.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
asiaraw <- terra::rast("data-raw/asia.tif")
template <- terra::project(asiaraw, "EPSG:3857")
terra::ncell(template)
template <- terra::spatSample(template, 100000, method = "regular", as.raster = TRUE)
template <- terra::spatSample(template, 50000,
method = "regular",
as.raster = TRUE
)
terra::ncell(template)
asia <- terra::project(asiaraw, template, method = "cubic")
asiaraw
Expand All @@ -21,18 +24,12 @@ ggplot() +
palette = "gmt_globe",
labels = scales::label_number(),
breaks = c(-10000, -5000, 0, 2500, 5000, 8000),
guide = guide_colorbar(
direction = "horizontal",
title.position = "top",
barwidth = 20
)
guide = guide_colorbar()
) +
labs(
fill = "elevation (m)",
title = "Hypsometric map of Asia"
) +
theme_minimal() +
theme(legend.position = "bottom")

theme_minimal()
unlink("inst/extdata/asia.tif")
terra::writeRaster(asia, "inst/extdata/asia.tif")
Binary file modified img/README-example-temp-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-hypso-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-hypso-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified inst/extdata/asia.tif
Binary file not shown.
2 changes: 1 addition & 1 deletion inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.3.2 (2023-10-31 ucrt)",
"version": "0.5.1"
"version": "0.5.1.9000"
}
14 changes: 5 additions & 9 deletions man/scale_cross_blended.Rd

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

13 changes: 5 additions & 8 deletions man/scale_hypso.Rd

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

4 changes: 3 additions & 1 deletion man/scale_terrain.Rd

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

4 changes: 3 additions & 1 deletion man/scale_whitebox.Rd

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

4 changes: 3 additions & 1 deletion man/scale_wiki.Rd

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

18 changes: 9 additions & 9 deletions tests/testthat/_snaps/autoplot-Spat/norgb-01-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b31d0b7

Please sign in to comment.