ggeem: EEM spectra plotted with ggplot2

View source: R/plot_functions.R

ggeemR Documentation

EEM spectra plotted with ggplot2

Description

Plots from EEM spectra of class ggplot. In case you work with a larger number of EEMs and want to show then in several plots, you can use eem_overview_plot.

Usage

ggeem(data, fill_max = FALSE, ...)

## Default S3 method:
ggeem(data, fill_max = FALSE, ...)

## S3 method for class 'eemlist'
ggeem(data, fill_max = FALSE, eemlist_order = TRUE, ...)

## S3 method for class 'eem'
ggeem(data, fill_max = FALSE, ...)

## S3 method for class 'parafac'
ggeem(data, fill_max = FALSE, ...)

## S3 method for class 'data.frame'
ggeem(
  data,
  fill_max = FALSE,
  colpal = "default",
  contour = FALSE,
  interpolate = FALSE,
  redneg = NULL,
  ...
)

Arguments

data

eem, eemlist, parafac or data.frame. The details are given under 'Details'.

fill_max

sets the maximum fluorescence value for the colour scale. This is mainly used by other functions, and makes different plots visually comparable.

...

parameters passed on to ggplot.

eemlist_order

logical, in case of an eemlist, the order of samples in the plot is the same as in the eemlist, alphabetically otherwise

colpal

"default" to use the viridis colour palette, "rainbow" to use a subset of the rainbow palette, any custom vector of colors or a colour palette. A gradient will be produced from this vector. Larger vectors (e.g. 50 elements) can produce smoother gradients.

contour

logical, whether contours should be plotted (default FALSE), see geom_contour

interpolate

logical, whether fluorescence should be interpolated, see geom_raster

redneg

deprecated! logical, whether negative values should be coloured discreet.

Details

The data can be of different sources: eem: a single EEM spectrum is plotted eemlist: all spectra of the samples are plotted, arranged in a grid data.frame: a data.frame containing EEM data. Can be created by e.g. as.data.frame.eem parafac: a PARAFAC model, the components are plotted then.

Using redneg you can give negative values a reddish colour. This can help identifying these parts in samples or components. Negative values are physically not possible and can only be the result of measuring errors, model deviations and problems with interpolated values.

Interpolation (interpolate = TRUE) leeds to smoother plots. The default is FALSE because it might cover small scale inconsistencies.

Contours (contour = TRUE)can be added to the EEM plots.

A colour palette can be specified using the argument colpal.

Plotting distinct samples can be done using eem_extract. Please see example.

Value

a ggplot object

Examples

## plotting two distinct samples
data(eem_list)
eem_names(eem_list)
eem <- eem_extract(eem_list,c("^d667sf$", "^d661sf$"),keep=TRUE)
ggeem(eem)

# the former redneg argument is deprecated, please see a similar looking example below!
#ggeem(eem, redneg = TRUE)
ggeem(eem, colpal = c(rainbow(75)[58],rainbow(75)[53:1]))

# use any custom colour palette
ggeem(eem, colpal = heat.colors(50))
# needs package matlab to be installed:
# ggeem(eem, colpal = matlab::jet.colors(50))
# or by adding ggplot2 colour and fill functions:
# ggeem(eem)+
#   scale_fill_viridis_c()+
#   scale_color_viridis_c()

ggeem(eem, interpolate = TRUE)
ggeem(eem, contour = TRUE)

staRdom documentation built on July 9, 2023, 5:57 p.m.