Learn R Programming

RastaRocket (version 1.1.2)

reverselog_trans: Reverse Log Transformation

Description

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

Usage

reverselog_trans(base = exp(1))

Value

A transformation object compatible with ggplot2 scales.

Arguments

base

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

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

Run this code
library(scales)
rev_log <- reverselog_trans(10)
rev_log$trans(100)  # -2
rev_log$inverse(-2) # 100

Run the code above in your browser using DataLab