Description Usage Arguments Details Examples
View source: R/highlight_ranges.R
Highlight wavelength ranges in a ggplot2 plot of hyperSpec object
1 2 3 4 5 | highlight_ranges(
zones,
fill = RColorBrewer::brewer.pal(9, "Set1")[1:length(zones)],
alpha = 0.2
)
|
zones |
formula or list of formulas, that indicate which zones of wavelength axis should be highlighted e.g., 460~800. |
fill |
vector of rectangle fill colors to be used for each zone; |
alpha |
(number from 0 to 1) Level of transperency. Default is 1 (not transperent). |
highlight_ranges()
Can be added to ggplot object using "+" operator.
1 2 3 4 5 6 | gg <- ggplot(Spectra2) + geom_line()
gg + highlight_ranges(400~500)
zones <- c(400~460, 545~670)
gg + highlight_ranges(zones)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.