Skip to content

Commit

Permalink
Fix unused arguments
Browse files Browse the repository at this point in the history
Another two statements passing redundant arguments that could depending on method dispatch end in ellipsis and remain unused.
  • Loading branch information
aphalo committed Sep 12, 2024
1 parent 35eea81 commit 17ae4f2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ggspectra
Type: Package
Title: Extensions to 'ggplot2' for Radiation Spectra
Version: 0.3.12.9002
Version: 0.3.13
Date: 2024-09-12
Authors@R:
c(
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ multiple spectra in long form.
introduced in version 0.3.12).
- Fix bug: Error when attempting to plot `cps_spct` objects with multiple
columns of `cps` data (bug introduced in version 0.3.12).
- Fix previously inconsequential bug in `autoplot()` methods revealed by stricter checks.
- In `autoplot.response_spct()` change default argument `norm = "max"` to
`norm = "update"` for consistency with the other `autoplot()` methods and
to avoid "surprising" users.
Expand All @@ -32,7 +33,7 @@ of spectra.
- Use in `autoplot()` methods a plotmath expression for the wavelength axis
label, including lambda as symbol, for consistency with the labels of the
_y_-axis.
- Revise of `autoplot()` methods to support a user-set default argument for
- Revise `autoplot()` methods to support a user-set default argument for
`range` given by R option `ggspectra.wlrange`.
- The former vignette _Plotting transformed data_ is now an article, no longer
part of the package and included only in the on-line documentation. It is
Expand Down
2 changes: 1 addition & 1 deletion R/autoplot-filter-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ O_plot <- function(spct,
idfactor <- getIdFactor(spct) # needed as we will get a tibble back
molten.tb <- photobiology::spct_wide2long(spct, idfactor = "variable", rm.spct.class = TRUE)

plot <- ggplot(molten.tb, aes(x = .data[["w.length"]], y = .data[["value"]]), na.rm = na.rm)
plot <- ggplot(molten.tb, aes(x = .data[["w.length"]], y = .data[["value"]]))
attributes(plot[["data"]]) <- c(attributes(plot[["data"]]), get_attributes(spct))
if (stacked) {
if (is.null(geom) || geom %in% c("spct", "area")) {
Expand Down
4 changes: 2 additions & 2 deletions R/autoplot-response-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ autoplot.response_mspct <-
col.name <- c(photon = "s.q.response", energy = "s.e.response")
if (is.response_spct(z) && any(col.name %in% names(z))) {
autoplot(object = z,
range = getOption("ggspectra.wlrange", default = NULL),
range = NULL,
norm = norm,
unit.out = unit.out,
pc.out = pc.out,
Expand All @@ -739,7 +739,7 @@ autoplot.response_mspct <-
z <- as.generic_spct(z)
autoplot(object = z,
y.name = paste(col.name[unit.out], plot.data, sep = "."),
range = getOption("ggspectra.wlrange", default = NULL),
range = NULL,
norm = norm,
pc.out = pc.out,
facets = facets,
Expand Down
10 changes: 9 additions & 1 deletion R/ggplot-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,13 @@ ggplot.generic_spct <-
stop("Invalid 'spct_class' argument: \"", spct_class)
}

if (!is.null(range)) {
spct <- trim_wl(x = spct,
range = range,
use.hinges = TRUE,
fill = NULL)
}

# this list could be defined in package 'photobiology'
funs <- list(filter_spct = photobiology::setFilterSpct,
reflector_spct = photobiology::setReflectorSpct,
Expand All @@ -480,7 +487,8 @@ ggplot.generic_spct <-
spct <- funs[[spct_class]](data, ...)

# dispatched to one of the methods defined above
ggplot2::ggplot(data = spct, mapping = mapping, range = range,
ggplot2::ggplot(data = spct,
mapping = mapping,
environment = environment)
}

Expand Down
2 changes: 1 addition & 1 deletion man/multipliers_label.Rd

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

0 comments on commit 17ae4f2

Please sign in to comment.