Skip to contents

Generate a breaks vector of size n with evenly spaced breaks in trans domain.

Usage

breaks_trans(n = 10, trans)

Arguments

n

<int> the size of the output vector. Ouput size will be at least length-2 for finite input.

trans

<scales::trans> an invertible transformer.

Details

Breaks are generated by transforming the input range to trans domain, generating a regular sequence of size n for the transformed range, then inverting the transform.

The input range must be finite for both the input domain and the trans domain. If input is not finite, an empty vector is returned.

See also

Examples

breaks_trans(trans = scales::identity_trans())(-10:10)
#>  [1] -10.000000  -7.777778  -5.555556  -3.333333  -1.111111   1.111111
#>  [7]   3.333333   5.555556   7.777778  10.000000
breaks_trans(trans = symlog_trans())(-10:10)
#>  [1] -10.0000000  -5.4561274  -2.7892346  -1.2239801  -0.3052999   0.3052999
#>  [7]   1.2239801   2.7892346   5.4561274  10.0000000
breaks_trans(trans = power_trans())(-10:10)
#>  [1] -10.0000000  -6.0493827  -3.0864198  -1.1111111  -0.1234568   0.1234568
#>  [7]   1.1111111   3.0864198   6.0493827  10.0000000
breaks_manual(c(-10, 0, 10))(-10:10)
#> [1] -10   0  10
breaks_manual(-1:1 * 1e6)(NULL)
#> [1]   -Inf -1e+06  0e+00  1e+06    Inf