Learn R Programming

tidyspec (version 0.1.0)

spec_smartplot: Create a Custom Plot for Spectral Data

Description

This function generates a customizable plot for spectral data, allowing for the selection of plot type (absorbance or transmittance), x-axis direction, and plot geometry (points or lines).

Usage

spec_smartplot(
  .data,
  wn_col = NULL,
  xdir = c("reverse", "standard"),
  geom = c("point", "line"),
  xmin = NULL,
  xmax = NULL,
  alpha = 0.8,
  type = c("absorbance", "transmittance")
)

Value

A `ggplot` object representing the customized spectral plot (absorbance or transmittance as a function of wavelength/wavenumber).

Arguments

.data

A `data.frame` or `tibble` containing spectral data.

wn_col

A character string specifying the column name for the wavelength or wavenumber data. This parameter is required.

xdir

A character string specifying the direction of the x-axis. Choices are `"reverse"` for reverse direction (typically used for wavenumber) or `"standard"` for standard direction.

geom

A character string specifying the geometry of the plot. Choices are `"point"` for a scatter plot or `"line"` for a line plot.

xmin

A numeric value specifying the minimum x-axis value for the plot. If not provided, the minimum value from the `wn_col` data will be used.

xmax

A numeric value specifying the maximum x-axis value for the plot. If not provided, the maximum value from the `wn_col` data will be used.

alpha

A numeric value specifying the transparency level of the plotted points or lines. Default is 0.8.

type

A character string specifying the y-labes as transmittance or absorbance. Default is absorbance.