@@ -75,7 +75,14 @@ e_rsp_plot <- function(spct,
75
75
spct <- photobiology :: trim_wl(spct , range = range )
76
76
}
77
77
if (! is.null(w.band )) {
78
- w.band <- photobiology :: trim_wl(w.band , range = photobiology :: wl_range(spct ))
78
+ if (" summaries" %in% annotations ) {
79
+ # boxes or segments display summarised wavelengths
80
+ w.band <- photobiology :: trim_wl(w.band ,
81
+ range = photobiology :: wl_range(spct ))
82
+ } else {
83
+ # boxes and segments display wavebands' definitions if they fit in plot
84
+ w.band <- photobiology :: trim_wl(w.band , range = range )
85
+ }
79
86
}
80
87
81
88
exposure.label <- NA
@@ -328,8 +335,14 @@ q_rsp_plot <- function(spct,
328
335
spct <- photobiology :: trim_wl(spct , range = range )
329
336
}
330
337
if (! is.null(w.band )) {
331
- w.band <- photobiology :: trim_wl(w.band ,
332
- range = photobiology :: wl_range(spct ))
338
+ if (" summaries" %in% annotations ) {
339
+ # boxes or segments display summarised wavelengths
340
+ w.band <- photobiology :: trim_wl(w.band ,
341
+ range = photobiology :: wl_range(spct ))
342
+ } else {
343
+ # boxes and segments display wavebands' definitions if they fit in plot
344
+ w.band <- photobiology :: trim_wl(w.band , range = range )
345
+ }
333
346
}
334
347
335
348
exposure.label <- NA
@@ -591,37 +604,50 @@ autoplot.response_spct <-
591
604
idfactor <- check_idfactor_arg(object , idfactor )
592
605
object <- rename_idfactor(object , idfactor )
593
606
594
- if (photobiology :: getMultipleWl(object ) > 1L
595
- && plot.data != " as.is" ) {
596
- return (
597
- autoplot(object = photobiology :: subset2mspct(object ),
598
- w.band = w.band ,
599
- range = range ,
600
- pc.out = pc.out ,
601
- label.qty = label.qty ,
602
- span = span ,
603
- wls.target = wls.target ,
604
- annotations = annotations ,
605
- by.group = by.group ,
606
- geom = geom ,
607
- time.format = time.format ,
608
- tz = tz ,
609
- text.size = text.size ,
610
- # chroma.type = chroma.type,
611
- idfactor = ifelse(is.null(idfactor ), TRUE , idfactor ),
612
- facets = facets ,
613
- plot.data = plot.data ,
614
- ylim = ylim ,
615
- object.label = object.label ,
616
- na.rm = na.rm )
617
- )
607
+ if (photobiology :: getMultipleWl(object ) > 1L ) {
608
+ if (plot.data == " as.is" ) {
609
+ if (facets ) {
610
+ # with a single spectrum per panel we include summaries
611
+ annotations.default <-
612
+ c(" boxes" , " labels" , " summaries" , " colour.guide" , " peaks" )
613
+ } else {
614
+ # We skip "summaries", which also affects trimming of wavebands
615
+ annotations.default <- c(" boxes" , " labels" , " colour.guide" , " peaks" )
616
+ }
617
+ } else {
618
+ # compute parallel summaries across spectra
619
+ return (
620
+ autoplot(object = photobiology :: subset2mspct(object ),
621
+ w.band = w.band ,
622
+ range = range ,
623
+ pc.out = pc.out ,
624
+ label.qty = label.qty ,
625
+ span = span ,
626
+ wls.target = wls.target ,
627
+ annotations = annotations ,
628
+ by.group = by.group ,
629
+ geom = geom ,
630
+ time.format = time.format ,
631
+ tz = tz ,
632
+ text.size = text.size ,
633
+ # chroma.type = chroma.type,
634
+ idfactor = ifelse(is.null(idfactor ), TRUE , idfactor ),
635
+ facets = facets ,
636
+ plot.data = plot.data ,
637
+ ylim = ylim ,
638
+ object.label = object.label ,
639
+ na.rm = na.rm )
640
+ )
641
+ }
642
+ } else {
643
+ # with a single spectrum we include summaries
644
+ annotations.default <-
645
+ c(" boxes" , " labels" , " summaries" , " colour.guide" , " peaks" )
618
646
}
619
647
620
648
annotations.default <-
621
- getOption(" photobiology.plot.annotations" ,
622
- default = c(" boxes" , " labels" , " summaries" , " colour.guide" , " peaks" ))
623
- annotations <- decode_annotations(annotations ,
624
- annotations.default )
649
+ getOption(" photobiology.plot.annotations" , default = annotations.default )
650
+ annotations <- decode_annotations(annotations , annotations.default )
625
651
626
652
# Change units if needed, and update normalization
627
653
object <- switch (unit.out ,
0 commit comments