Learn R Programming

Ternary (version 2.3.3)

.SetRegion: Set plotting region

Description

Sets the region of the ternary plot being drawn. Usually called from within TernaryPlot(); everyday users are unlikely to need to call this function directly.

Usage

.SetRegion(region, prettify = NA_integer_, set = TRUE)

Value

.SetRegion() returns the value of options(ternRegion = region)

if set == TRUE, or the region, otherwise..

Arguments

region

(optional) Named list of length two specifying the the minimum and maximum values of each ternary axis to be drawn (e.g. list(min = c(40, 0, 0), max = c(100, 60, 60)); or a set of coordinates in a format accepted by TernaryPoints(). The plotted region will correspond to the smallest equilateral triangle that encompasses the specified ranges or coordinates.

prettify

If numeric, the plotting region will be expanded to allow grid lines to be produced with pretty(n = prettify). If NA, the smallest region encompassing region will be used.

set

Logical specifying whether to set options(ternRegion = region)

Examples

Run this code
# XY Coordinates under original plotting region
TernaryToXY(c(1, 2, 3))
previous <- .SetRegion(rbind(min = c(20, 20, 20), max = c(60, 60, 60)))

# New region options set
getOption("ternRegion")

# Coordinates under new plotting region
TernaryToXY(c(1, 2, 3))

# Restore previous setting
options(previous)
getOption("ternRegion")

Run the code above in your browser using DataLab