place_rule: Places a line on the rgb plot

Description Usage Arguments Details Value See Also Examples

View source: R/place_rule.R

Description

A wrapper function for graphics::locator that makes the creation of rules easier.

Usage

1
place_rule(x_axis, y_axis, line_type = "f")

Arguments

x_axis

a character string indicating the colour variable that corresponds to the x axis, one of "r", "g" or "b".

y_axis

a character string indicating the colour variable that corresponds to the y axis, one of "r", "g" or "b".

line_type

a character string indicating that the line is vertical "v", horizontal "h" or free ("f", the default).

Details

This function calls graphics::locator allowing to select two points, plots the line joining these points and returns a list containing their coordinates. The coordinates are rearranged to pass them to define_rule().

True horizontal and vertical lines are difficult to create by hand. In these cases, specifying "vertical" or "horizontal" (partial match allowed, i e "h") will copy the appropriate coordinate value from the first point to the second. Note that this is done after locator() returns, so the plot will show the line joining the original points, not the corrected ones. Use plot_rule() to see corrected line.

Value

A list of class rule_points containing the following elements:

See Also

locator, define_rule, plot_rule, plot_rgb_plane

Examples

1
2
3
4
5
6
## Not run: 
plot_rgb_plane("r", "g")
line01 <- place_rule("r", "g")          # A "free" line
line02 <- place_rule("r", "g", "h")     # A horizontal line

## End(Not run)

ropensci/pixelclasser documentation built on Feb. 25, 2021, 2:08 p.m.