pretty2: Truncated pretty breakpoints

View source: R/pretty2.R

pretty2R Documentation

Truncated pretty breakpoints

Description

pretty with no values outside of x range

Usage

pretty2(x, n = 5, force = FALSE, ...)

Arguments

x

object with numeric values

n

desired number of values in pretty. DEFAULT: 5

force

Must output length equal n exactly? DEFAULT: FALSE

...

all other arguments in pretty.

Details

calculates pretty(x), then removes the values that do not lie within range(x).
If force=TRUE, range(x) is reduced step by step in a while loop until the condition is met. This is useful if you want exactly 2 labels on an axis. In order not to get stuck, the outer values are taken if there are more than n values within range(x).

Author(s)

Berry Boessenkool, berry-b@gmx.de, Aug 2014

See Also

pretty , logVals

Examples


k <- c(135, 155, 120, 105, 140, 130, 190, 110)
range(k)
pretty(k)
pretty2(k)

pretty(c(0.2, 0.9), n=2)
pretty2(c(0.2, 0.9), n=2)
pretty2(c(0.2, 0.9), n=2, force=TRUE)


berryFunctions documentation built on May 29, 2024, 4:01 a.m.