place_rule {pixelclasser}R Documentation

Places a line on the rgb plot

Description

A wrapper function for graphics::locator that helps in creating rules.

Usage

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

is.rule_points(x)

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).

x

the R object being tested

Details

This function calls graphics::locator on a previously plotted rgb plane to select two points with the mouse. Then it plots the line joining them and returns an object of class "pixel_rule_object". These objects are passed as parameters to pixel_rule() to create "pixel_rule" objects.

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 to make them the same. 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 the corrected line.

Value

An object of class "pixel_rule_points" containing these elements:

See Also

locator, pixel_rule, plot_rule, plot_rgb_plane

Examples

## 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)


[Package pixelclasser version 1.1.1 Index]