highlight_substance: Highlight a selected substance

Description Usage Arguments Value Examples

View source: R/plot_methods.R

Description

The function highlights a selected substance(s) -or cluster(s)- in a plot. It can add to an existing plot or create a new one. Currently implemented only for S3 objects returned by clipper.

Usage

1
2
3
4
5
6
7
8
9
highlight_substance(
  x,
  dst_cluster,
  new = TRUE,
  clusternames = NULL,
  polygon_color = "red",
  match_uFTIR = FALSE,
  ...
)

Arguments

x

"clipper" object to plot

dst_cluster

cluster (or substance) to highlight. Numeric and character inputs are supported. If is char, then you should provide clusternames to coerse it to numeric.

new

Do you want a new plot or the function should add the polygons to the current plot?

clusternames

char vector given the list of analyzed substance clusters. Only relevant when dst_cluster is a character.

polygon_color

color of the overploted polygons. Red by default.

match_uFTIR

The Agilent Microscope transposes and inverts the image (it inverts rows only -cols after transposition). Do you want the plot function to match this behaviour? Default FALSE.

...

other arguments for plot_tile

Value

A function that plots and returns NULL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
x <- tile_read(base::system.file("extdata/tile.bsp", package = "uFTIR"))
x <- tile_base_corr(x)
x <- wavealign(x, primpke)
x <- tile_sam(x)
x <- smooth_sam(x, as.integer(length(primpke@clusternames)), window = 3, 1)
clip <- toClip(8,20,c(10,10))
plot(x)
polygon(clip@xycoords)
x <- clipper(x, clip@centre, clip@rad, 1)

highlight_substance(x, 5)

uFTIR documentation built on Oct. 25, 2021, 9:08 a.m.