Truncated pretty breakpoints

Share:

Description

pretty with no values outside of x range

Usage

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

Arguments

x

object with numeric values

n

desired number of values in pretty. DEFAULT: 5

force

Must output lenght 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

1
2
3
4
5
6
7
8
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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.