Skip to content

Commit

Permalink
add option to not make rel in plot
Browse files Browse the repository at this point in the history
  • Loading branch information
wincowgerDEV committed Jul 3, 2024
1 parent ecdfbc7 commit 8f0aaaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/interactive_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -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}()}.
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions man/interactive_plots.Rd

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

0 comments on commit 8f0aaaa

Please sign in to comment.