Skip to content

Add inverse hyperbolic sine transformation #297

Closed

Description

@frederikziebell

Sometimes it's nice to have a 'log'-transformation that also works for negative values to have points more evenly spread-out:

ihs <- function(x){log(x+sqrt(x^2+1))}
ihs_trans <- scales::trans_new(name="ihs",transform=ihs, inverse=sinh)

set.seed(1)
data <- tibble(
  x=runif(10^4),
  y=rnorm(10^4)
)

data %>% 
  ggplot(aes(x,y)) +
    geom_point(alpha=.7) +
    ggtitle("regular")

data %>% 
  ggplot(aes(x,y)) +
    geom_point(alpha=.7) +
    scale_y_continuous(trans=ihs_trans) +
    ggtitle("ihs")

image
image

Activity

  1. hadley commented on Mar 16, 2022

    @hadley
    Member

    Sure, do you want to do a PR?

  2. added a commit that references this issue on Aug 25, 2022
  3. added a commit that references this issue on Nov 2, 2023
  4. thomasp85 commented on Nov 3, 2023

    @thomasp85
    Member

    Fixed by #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions