Skip to content

Commit

Permalink
Cleanup remaining norm = .... from autoplot() calls
Browse files Browse the repository at this point in the history
Also update NEWS and run benchmarks. Delete benchmarks raw data as the files are huge.
  • Loading branch information
aphalo committed Dec 23, 2024
1 parent 2747254 commit d75ccf1
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 19 deletions.
9 changes: 7 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ editor_options:

- Update for compatibility with 'photobiology' (>= 0.12.0), which is required.
- `autoplot()` methods no longer support normalization on-the-fly, but existing
normalization is updated when the unit or quantity is modified.
normalization is updated when the unit or quantity is modified for plotting.
- The argument passed to `idfactor` when plotting multiple spectra stored in
long form, can be used to rename the existing idfactor of the spectral object.
long form can now be used to rename the existing `idfactor` of the spectral
object for plotted.
- The y-scale functions now accept other than numeric values as arguments to
parameter `normalized`, character values are used as is as subscript, typically
for the type normalization. In case of logical `TRUE`, `"norm"` is used as
subindex.

# ggspectra 0.3.15

Expand Down
5 changes: 1 addition & 4 deletions R/autoplot-calibration-spct.R
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ autoplot.calibration_spct <-
autoplot(object = subset2mspct(object),
w.band = w.band,
range = range,
norm = norm,
unit.out = unit.out,
pc.out = pc.out,
label.qty = label.qty,
Expand Down Expand Up @@ -333,7 +332,7 @@ autoplot.calibration_spct <-
pc.out = pc.out,
annotations = annotations,
geom = geom,
norm = norm,
norm = FALSE, # cal_plot needs to be updated
text.size = text.size,
idfactor = idfactor,
facets = facets,
Expand Down Expand Up @@ -388,7 +387,6 @@ autoplot.calibration_mspct <-
autoplot(object = z,
range = getOption("ggspectra.wlrange", default = NULL),
unit.out = unit.out,
norm = norm,
pc.out = pc.out,
idfactor = NULL, # use idfactor already set in z
facets = facets,
Expand All @@ -401,7 +399,6 @@ autoplot.calibration_mspct <-
y.name = paste("irrad.mult", plot.data, sep = "."),
range = getOption("ggspectra.wlrange", default = NULL),
unit.out = unit.out,
norm = norm,
pc.out = pc.out,
idfactor = NULL, # use idfactor already set in z
facets = facets,
Expand Down
7 changes: 2 additions & 5 deletions R/autoplot-cps-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ cps_plot <- function(spct,
#'
#' autoplot(white_led.cps_spct)
#' autoplot(white_led.cps_spct, geom = "spct")
#' autoplot(white_led.cps_spct, norm = "max")
#' autoplot(normalize(white_led.cps_spct, norm = "max"))
#'
#' two_leds.mspct <-
#' cps_mspct(list("LED 1" = white_led.cps_spct,
Expand Down Expand Up @@ -281,7 +281,6 @@ autoplot.cps_spct <-
autoplot(object = subset2mspct(object),
w.band = w.band,
range = range,
norm = norm,
unit.out = unit.out,
pc.out = pc.out,
label.qty = label.qty,
Expand Down Expand Up @@ -348,7 +347,7 @@ autoplot.cps_mspct <-
function(object,
...,
range = getOption("ggspectra.wlrange", default = NULL),
norm = "skip",
norm = NA,
unit.out = NULL,
pc.out = getOption("ggspectra.pc.out", default = FALSE),
idfactor = TRUE,
Expand Down Expand Up @@ -383,7 +382,6 @@ autoplot.cps_mspct <-
if (is.cps_spct(z) && any(c("cps", "cps_1") %in% names(z))) {
autoplot(object = z,
range = getOption("ggspectra.wlrange", default = NULL),
norm = norm,
pc.out = pc.out,
idfactor = NULL, # use idfactor already set in z
facets = facets,
Expand All @@ -395,7 +393,6 @@ autoplot.cps_mspct <-
autoplot(object = z,
y.name = paste("cps", plot.data, sep = "."),
range = getOption("ggspectra.wlrange", default = NULL),
norm = norm,
pc.out = pc.out,
idfactor = NULL, # use idfactor already set in z
facets = facets,
Expand Down
2 changes: 0 additions & 2 deletions R/autoplot-raw-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ autoplot.raw_mspct <-
if (is.raw_spct(z) && any(c("counts", "counts_1") %in% names(z))) {
autoplot(object = z,
range = getOption("ggspectra.wlrange", default = NULL),
norm = norm,
unit.out = unit.out,
pc.out = pc.out,
idfactor = NULL, # use idfactor already set in z
Expand All @@ -427,7 +426,6 @@ autoplot.raw_mspct <-
autoplot(object = z,
y.name = paste("counts", plot.data, sep = "."),
range = getOption("ggspectra.wlrange", default = NULL),
norm = norm,
pc.out = pc.out,
idfactor = NULL, # use idfactor already set in z
facets = facets,
Expand Down
3 changes: 0 additions & 3 deletions R/autoplot-response-spct.r
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,6 @@ autoplot.response_spct <-
autoplot(object = photobiology::subset2mspct(object),
w.band = w.band,
range = range,
norm = norm,
pc.out = pc.out,
label.qty = label.qty,
span = span,
Expand Down Expand Up @@ -735,7 +734,6 @@ autoplot.response_mspct <-
if (photobiology::is.response_spct(z) && any(col.name %in% names(z))) {
autoplot(object = z,
range = NULL,
norm = norm,
unit.out = unit.out,
pc.out = pc.out,
facets = facets,
Expand All @@ -748,7 +746,6 @@ autoplot.response_mspct <-
autoplot(object = z,
y.name = paste(col.name[unit.out], plot.data, sep = "."),
range = NULL,
norm = norm,
pc.out = pc.out,
facets = facets,
idfactor = NULL, # use idfactor already set in z
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion inst-not/benchmark-autoplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ p10 <- autoplot(sun_evening.spct)
p11 <- autoplot(sun_evening.mspct)
p12 <- autoplot(sun_evening.spct, annotations = "")
p13 <- autoplot(sun_evening.mspct, annotations = "")
p14 <- autoplot(sun_evening.mspct, annotations = "", norm = "skip")
p14 <- autoplot(sun_evening.mspct, annotations = "", idfactor = "Times")
p15 <- autoplot(sun_evening.spct, facets = 2)
p16 <- autoplot(sun_evening.mspct, facets = 2)
p17 <- autoplot(sun_evening.spct, plot.data = "mean")
Expand Down
4 changes: 2 additions & 2 deletions man/autoplot.cps_spct.Rd

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

0 comments on commit d75ccf1

Please sign in to comment.