GraphicsOptions: Graphic Output Options in ChemoSpec and ChemoSpec2D

Description Details Author(s) Examples

Description

In ChemoSpec and ChemoSpec2D, the user may chose from the following graphics output options:

Details

Here's how it works:

What you can do with your plots:

Author(s)

Bryan A. Hanson (DePauw University), Tejasvi Gupta.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if (checkForPackageWithVersion("ChemoSpec", 6.0)) {
  library("ChemoSpec")
  library("ggplot2")
  data(metMUD1)

# Using the default ggplot2 graphics
  p1 <- plotSpectra(metMUD1,
    which = c(10, 11), yrange = c(0, 1.5),
    offset = 0.06, amplify = 10, lab.pos = 0.5)
  p1

# Modifying ggplot2 graphics
# Add a title
  p2 <- p1 + ggtitle("metMUD1 NMR Data")
  p2

# Zoom the axes
  p3 <- p1 + coord_cartesian(xlim = c(1.5, 2.0))
  p3

# Change the ggplot2 theme
  p4 <- p1 + theme_gray() + theme(legend.position = "none")
  p4

# plotLoadings uses patchwork, whose plots are modified differently
  pca <- c_pcaSpectra(metMUD1)
  p5 <- plotLoadings(metMUD1, pca, loads = c(1, 2))
  p5
  p6 <- p5 + patchwork::plot_annotation(title = "metMUD1 NMR Data")
  p6
# but to change the theme on each subplot, use the & operator
  p7 <- p6 & theme_gray() # compare to p6 + theme_gray()
  p7
}

ChemoSpecUtils documentation built on Oct. 10, 2021, 5:06 p.m.