Skip to content

Commit

Permalink
Merge pull request #257 from rmaia/R-4.0.0
Browse files Browse the repository at this point in the history
Update minimum R version to 4.0.0
  • Loading branch information
thomased authored Jul 9, 2024
2 parents a3e3986 + aeb94f6 commit 997b4f9
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 32 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages:
any::rcmdcheck,
[email protected]
any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ License: GPL (>= 2)
URL: http://pavo.colrverse.com, https://github.com/rmaia/pavo/
BugReports: https://github.com/rmaia/pavo/issues
Depends:
R (>= 3.5.0)
R (>= 4.0.0)
Imports:
cluster,
future.apply,
Expand All @@ -49,8 +49,7 @@ Imports:
farver,
plot3D,
progressr,
sf,
viridisLite
sf
Suggests:
alphashape3d,
imager,
Expand All @@ -68,5 +67,5 @@ Config/Needs/website:
Encoding: UTF-8
Language: en-GB
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Config/testthat/edition: 3
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
S3method(as.rimg,"magick-image")
S3method(as.rimg,cimg)
S3method(as.rimg,default)
S3method(imager::as.cimg,rimg)
S3method(merge,rspec)
S3method(plot,colspace)
S3method(plot,rimg)
Expand Down Expand Up @@ -56,7 +57,6 @@ export(procimg)
export(procspec)
export(projplot)
export(projpoints)
export(rimg2cimg)
export(rimg2magick)
export(segplot)
export(segspace)
Expand Down Expand Up @@ -102,7 +102,6 @@ importFrom(graphics,lines)
importFrom(graphics,locator)
importFrom(graphics,mtext)
importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(graphics,plot.default)
importFrom(graphics,plot.new)
importFrom(graphics,plot.window)
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# pavo 2.10.0

## NEW FEATURES AND SIGNIFICANT CHANGES

- the `rimg2cimg()` function has been removed in favour of a custom `as.cimg()` method.

## MINOR FEATURES AND BUG FIXES

- `as.rspec()` now works out of the box with `tibble`, rather than requiring users to pass a standard data.frame.

## INTERNAL CHANGES

- dependency on the `viridisLite` package has been removed in favour of recent base R functions

# pavo 2.9.0

## NEW FEATURES AND SIGNIFICANT CHANGES
Expand Down
10 changes: 6 additions & 4 deletions R/aggplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#'
#' @export
#'
#' @importFrom graphics legend lines par plot.default polygon
#' @importFrom graphics legend lines par polygon
#' @importFrom grDevices adjustcolor
#' @importFrom stats sd
#'
Expand Down Expand Up @@ -137,9 +137,11 @@ aggplot <- function(rspecdata, by = NULL, FUN.center = mean, FUN.error = sd,
lcol <- rep(lcol, ncol(cntplotspecs))
}

col_list <- c(
"#E41A1C", "#377EB8", "#4DAF4A", "#984EA3",
"#FF7F00", "#FFFF33", "#A65628", "#F781BF"
col_list <- grDevices::palette.colors(
ncol(cntplotspecs),
palette = "Okabe-Ito",
alpha = 1,
recycle = TRUE
)

col_list <- rep_len(col_list, dim(cntplotspecs)[2])
Expand Down
6 changes: 3 additions & 3 deletions R/as.rimg.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ NULL

#' @rdname img_conversion
#'
#' @export
rimg2cimg <- function(image) {
#' @exportS3Method imager::as.cimg
as.cimg.rimg <- function(image) {
## Check for imager
if (!requireNamespace("imager", quietly = TRUE)) {
stop("Package \"imager\" needed for conversion to cimg. Please install it.",
call. = FALSE
)
}
suppressWarnings(imager::as.cimg(image, cc = 3))
NextMethod("as.cimg", image, cc = 3)
}
#' @rdname img_conversion
#'
Expand Down
2 changes: 1 addition & 1 deletion R/explorespec.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ explorespec <- function(rspecdata, by = NULL,
arg$x <- wl

if (is.null(arg$col)) {
col_list <- viridisLite::viridis(max(table(by)))
col_list <- grDevices::hcl.colors(max(table(by)))
} else {
col_list <- arg$col
}
Expand Down
2 changes: 1 addition & 1 deletion R/jndplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#'
#' @export
#'
#' @importFrom graphics plot.default par plot.default points arrows
#' @importFrom graphics par points arrows
#' @importFrom grDevices trans3d
#'
#' @keywords internal
Expand Down
2 changes: 1 addition & 1 deletion R/pavo-package.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' @keywords internal
"_PACKAGE"

#' @importFrom graphics plot
#' @importFrom graphics plot.default
# This functions has been moved to base since R 4.0.0
NULL

Expand Down
2 changes: 1 addition & 1 deletion R/plot.rspec.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ plot.rspec <- function(x, select = NULL, type = c("overlay", "stack", "heatmap")
}

if (is.null(arg$col)) {
arg$col <- viridisLite::cividis(n)
arg$col <- grDevices::hcl.colors(n, palette = "cividis")
} else {
jc <- colorRampPalette(arg$col)
arg$col <- jc(n)
Expand Down
9 changes: 5 additions & 4 deletions R/plotsmooth.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ plotsmooth <- function(rspecdata, minsmooth = 0.05, maxsmooth = 0.20,

par(mar = c(2, 2, 2, 2), oma = c(3, 3, 0, 0))

col_list <- c(
"#000000", "#E41A1C", "#377EB8", "#4DAF4A", "#984EA3",
"#FF7F00", "#ffdd33", "#A65628", "#F781BF"
cols <- grDevices::palette.colors(
n = length(curves),
palette = "Okabe-Ito",
alpha = 1,
recycle = TRUE
)
cols <- col_list[seq_len(curves)]

# Creates the smooth data matrix
for (i in seq_len(nplots)) {
Expand Down
2 changes: 1 addition & 1 deletion R/procimg.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ procimg <- function(image, resize = NULL, rotate = NULL, scaledist = NULL,
}

# Internal function for calibrating image scale
#' @importFrom graphics plot rasterImage locator
#' @importFrom graphics rasterImage locator
#' @importFrom stats dist
scaler <- function(image_i, scaledist_i, col, ...) {
# Plot
Expand Down
4 changes: 2 additions & 2 deletions man/img_conversion.Rd

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

9 changes: 3 additions & 6 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: http://pavo.colrverse.com
url: https://pavo.colrverse.com

home:
title: Perceptual Analysis, Visualization and Organization of Spectral Colour Data in R
Expand All @@ -18,27 +18,24 @@ reference:
- '`merge.rspec`'
- '`procimg`'
- '`procspec`'
- '`rimg2cimg`'
- '`spec2rgb`'
- '`subset.rspec`'
- '`simulate_spec`'
- img_conversion

- title: Visualisation
desc: "Functions for visualising spectral data, including the results of visual modelling"
contents:
- starts_with("plot.")
- '`aggplot`'
- '`axistetra`'
- '`explorespec`'
- '`legendtetra`'
- '`plot.colspace`'
- '`plot.rimg`'
- '`plot.rspec`'
- '`plotsmooth`'
- '`points.colspace`'
- '`projplot`'
- '`sensdata`'
- '`tcsplot`'
- '`plot.sensmod`'

- title: Analysis
desc: "Functions for analysing spectral data"
Expand Down

0 comments on commit 997b4f9

Please sign in to comment.