diff --git a/R/interactive_plots.R b/R/interactive_plots.R index 334c844b..61246bed 100644 --- a/R/interactive_plots.R +++ b/R/interactive_plots.R @@ -38,6 +38,7 @@ #' `"Portland"`, `"Rainbow"`, `"RdBu"`, `"Reds"`, `"Viridis"`, `"YlGnBu"`, #' `"YlOrRd"`. #' @param showlegend whether to show the legend passed to +#' @param make_rel logical, whether to make the spectra relative or use the raw values #' @param type specification for plot type either interactive or static #' \code{\link[plotly]{plot_ly}()}. #' @param \ldots further arguments passed to \code{\link[plotly]{plot_ly}()}. @@ -88,8 +89,9 @@ plotly_spec.OpenSpecy <- function(x, plot_bgcolor = 'rgba(17, 0, 73, 0)', paper_bgcolor = 'rgb(0, 0, 0)', showlegend = FALSE, + make_rel = TRUE, ...) { - x <- make_rel(x, na.rm = T) + if(make_rel) x <- make_rel(x, na.rm = T) dt <- cbind(wavenumber = x$wavenumber, x$spectra) |> melt( id.vars = "wavenumber", @@ -117,7 +119,7 @@ plotly_spec.OpenSpecy <- function(x, ) if(!is.null(x2)) { - x2 <- make_rel(x2, na.rm = T) + if(make_rel) x2 <- make_rel(x2, na.rm = T) dt2 <- cbind(wavenumber = x2$wavenumber, x2$spectra) |> melt( id.vars = "wavenumber", diff --git a/man/interactive_plots.Rd b/man/interactive_plots.Rd index e05a9657..3c8832e1 100644 --- a/man/interactive_plots.Rd +++ b/man/interactive_plots.Rd @@ -25,6 +25,7 @@ plotly_spec(x, ...) plot_bgcolor = "rgba(17, 0, 73, 0)", paper_bgcolor = "rgb(0, 0, 0)", showlegend = FALSE, + make_rel = TRUE, ... ) @@ -86,6 +87,8 @@ spectral data for the second group.} \item{showlegend}{whether to show the legend passed to} +\item{make_rel}{logical, whether to make the spectra relative or use the raw values} + \item{z}{optional numeric vector specifying the intensity values for the heatmap. If not provided, the function will use the intensity values from the \code{OpenSpecy} object.}