Creates a transformation object for a reverse log scale, which can be used in ggplot2 scales.

reverselog_trans(base = exp(1))

Arguments

base

A numeric value specifying the logarithm base. Default is the natural logarithm (exp(1)).

Value

A transformation object compatible with ggplot2 scales.

Details

This function defines a reverse logarithmic transformation, where the transformation function is $$-\log(x, \text{base})$$ and the inverse function is $$\text{base}^{-x}$$. It is useful for cases where a decreasing log scale is needed.

Examples

library(scales)
#> Warning: package 'scales' was built under R version 4.4.3
rev_log <- reverselog_trans(10)
rev_log$trans(100)  # -2
#> [1] -2
rev_log$inverse(-2) # 100
#> [1] 100