plotsp | R Documentation |
plotsp
plots lines corresponding to the row observations (e.g. spectra) of a data set.
plotsp1
plots only one observation per plot (e.g. spectrum by spectrum) by scrolling the rows. After running a plotsp1
command, the plots are printed successively by pushing the R console "entry button", and stopped by entering any character in the R console.
plotsp(X,
type = "l", col = NULL, zeroes = FALSE, labels = FALSE,
add = FALSE,
...)
plotsp1(X, col = NULL, zeroes = FALSE, ...)
X |
Data ( |
type |
1-character string giving the type of plot desired. Default value to |
col |
A color, or a vector of colors (of length n), defining the color(s) of the lines representing the rows. |
zeroes |
Logical indicationg if an horizontal line is drawn at coordonates (0, 0) (Default to |
labels |
Logical indicating if the row names of |
add |
Logical defining if the frame of the plot is plotted ( |
... |
Other arguments to pass in functions |
.
A plot (see examples).
data(cassav)
X <- cassav$Xtest
n <- nrow(X)
plotsp(X)
plotsp(X, col = "grey")
plotsp(X, col = "lightblue",
xlim = c(500, 1500),
xlab = "Wawelength (nm)", ylab = "Absorbance")
### See: ?hcl.colors, hcl.pals()
col <- hcl.colors(n = n, alpha = 1, rev = FALSE, palette = "Grays")
#col <- hcl.colors(n = n, alpha = 1, rev = FALSE, palette = "Green-Orange")
#col <- terrain.colors(n, rev = FALSE)
#col <- rainbow(n, rev = FALSE, alpha = .2)
plotsp(X, col = col)
plotsp(X, col = "grey")
plotsp(X[23, , drop = FALSE], lwd = 2, add = TRUE)
plotsp(X[c(23, 16), ], lwd = 2, add = TRUE)
plotsp(X[5, , drop = FALSE], labels = TRUE)
plotsp(X[c(5, 61), ], labels = TRUE)
col <- hcl.colors(n = n, alpha = 1, rev = FALSE, palette = "Grays")
plotsp(X, col = col)
plotsp(X[5, , drop = FALSE], col = "red", lwd = 2, add = TRUE, labels = TRUE)
###### Example with plotsp1
###### Scrolling plot of PCA loadings
## After running the code,
## type Enter in the R console for starting the scrolling,
## and type any character in the R console
fm <- pcaeigenk(X, nlv = 20)
P <- fm$P
## Run the plot:
#plotsp1(t(P), ylab = "Value")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.