This function provides easy plotting for mass and ratio chromatograms from continuous flow IRMS data. It can be called either directly with a set of iso_file objects, or with a data frame prepared for plotting chromatographic data (see iso_prepare_continuous_flow_plot_data).

iso_plot_continuous_flow_data(...)

# S3 method for iso_file_list
iso_plot_continuous_flow_data(iso_files,
  data = c(), time_interval = c(), time_interval_units = "seconds",
  filter = NULL, normalize = FALSE, zoom = NULL, panel = data,
  color = file_id, linetype = NULL, label = file_id,
  peak_table = NULL, file_id = default(file_id), rt = default(rt),
  rt_start = default(rt_start), rt_end = default(rt_end),
  rt_unit = NULL, peak_marker = FALSE,
  peak_bounds = !is.null(peak_table), peak_label = NULL,
  peak_label_filter = NULL, peak_label_size = 2,
  peak_label_repel = 1)

# S3 method for data.frame
iso_plot_continuous_flow_data(df, panel = data,
  color = file_id, linetype = NULL, label = file_id,
  peak_marker = FALSE, peak_bounds = FALSE, peak_label = NULL,
  peak_label_filter = NULL, peak_label_size = 2,
  peak_label_repel = 1)

Arguments

...

S3 method placeholder parameters, see class specific functions for details on parameters

iso_files

collection of iso_file objects

data

which masses and ratios to plot (e.g. c("44", "45", "45/44") - without the units), if omitted, all available masses and ratios are plotted. Note that ratios should be calculated using iso_calculate_ratios prior to plotting.

time_interval

which time interval to plot

time_interval_units

which units the time interval is in, default is "seconds"

filter

any filter condition to apply to the data beyond the masses/ratio selection (param data) and time interval (param time_interval). For details on the available data columns see iso_get_raw_data with parameters gather = TRUE and include_file_info = everything() (i.e. all file info is available for plotting aesthetics).

normalize

whether to normalize the data (default is FALSE, i.e. no normalization). If TRUE, normalizes each trace across all files (i.e. normalized to the global max/min). This is particularly useful for overlay plotting different mass and/or ratio traces (panel = NULL). Note that zooming (if zoom is set) is applied after normalizing.

zoom

if not set, automatically scales to the maximum range in the selected time_interval in each plotting panel. If set, scales by the indicated factor, i.e. values > 1 are zoom in, values < 1 are zoom out, baseline always remains the bottom anchor point. Note that zooming is always relative to the max in each zoom_group (by default zoom_group = data, i.e. each trace is zoomed separately). The maximum considered may be outside the visible time window. Note that for zoom_group other than data (e.g. file_id or NULL), zooming is relative to the max signal across all mass traces. Typically it makes most sense to set the zoom_group to the same variable as the planned panel parameter to the plotting function. Lastly, note that zooming only affects masses, ratios are never zoomed.

panel

whether to panel plot by anything - any column or complex expression is possible (see notes in the filter parameter for available raw data columns and iso_get_file_info for available file info columns) but the most commonly used options are panel = NULL (overlay all), panel = data (by mass/ratio data), panel = file_id (panel by files, alternatively use any appropriate file_info column or expression that's unique for each file). The default is panelling by the data column.

color

whether to color plot by anything, options are the same as for panel but the default is file_id

linetype

whether to differentiate by linetype, options are the same as for panel but the default is NULL (i.e. no linetype aesthetic). Note that a limited number of linetypes (6) is defined by default and the plot will fail if a higher number is required unless specified using scale_linetype.

label

this is primarily of use for turning the generated ggplots into interactive plots via ggplotly as the label will be rendered as an additional mousover label. Any unique file identifier is a useful choice, the default is file_id.

peak_table

a data frame that describes the peaks in this chromatogram. By default, the chromatographic data is prepared WITHOUT peaks information. Supply this parameter to add in the peaks data. Note that the following parameters must also be set correctly IF peak_table is supplied: file_id, rt, rt_start, rt_end.

file_id

the column (or columns) that uniquely identify each iso_file for proper matching of the raw chromatography data with the peak_table data. In most cases, the default (file_id) should work fine.

rt

the column in the peak_table that holds the retention time of the peak.

rt_start

the column in thepeak_table that holds the retention time where each peak starts.

rt_end

the column in thepeak_table that holds the retention time where each peak ends.

rt_unit

which time unit the retention time columns (rt, rt_start, rt_end) are in. If not specified (i.e. the default), assumes it is the same unit as the time column of the iso_files raw data.

peak_marker

whether to mark identified peaks with a vertical line at the peak retention time. Only works if a peak_table was provided to identify the peaks and will issue a warning if peak_marker = TRUE but no peaks were identified.

peak_bounds

whether to mark the boundaries of identified peaks with a vertical ine at peak start and end retention times. Only works if a peak_table was provided to identify the peaks and will issue a warning if peak_bounds = TRUE but no peaks were identified.

peak_label

whether to label identified peaks. Any valid column or complex expression is supported and ALL columns in the provided peak_table can be used in this expression. To provide more space for peak labels, it is sometimes useful to use a zoom value smaller than 1 to zoom out a bit, e.g. zoom = 0.9. If peak labels overlap, consider changing peak_label_size and/or peak_label_repel. Note that this only works if a peak_table was provided to identify the peaks and will issue a warning if peak_label is set but no peaks were identified. Also note that peaks whose value at the peak retention time is not visible on the panel due to e.g. a high zoom value will not have a visible label either.

peak_label_filter

a filter for the peak labels (if supplied). Can be useful for highlighting only a subset of peaks with peak labels (e.g. only one data trace, or only those in a certain portion of the chromatogram). Only interpreted if peak_table is set.

peak_label_size

the font size for the peak labels. Depends largely on how much data is shown and how busy the chromatograms are. Default is a rather small font size (2), adjust as needed.

peak_label_repel

how strongly the labels repel each other. Increase the value if large labels overlap (e.g. to 5 or 10).

df

a data frame of the chromatographic data prepared for plotting (see iso_prepare_continuous_flow_plot_data)

See also