Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inverse hyperbolic sine transformation #297

Closed
frederikziebell opened this issue Oct 7, 2020 · 2 comments
Closed

Add inverse hyperbolic sine transformation #297

frederikziebell opened this issue Oct 7, 2020 · 2 comments
Labels
feature a feature request or enhancement

Comments

@frederikziebell
Copy link

frederikziebell commented Oct 7, 2020

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

@hadley
Copy link
Member

hadley commented Mar 16, 2022

Sure, do you want to do a PR?

@hadley hadley added the feature a feature request or enhancement label Mar 16, 2022
pearsonca added a commit to pearsonca/scales that referenced this issue Aug 25, 2022
answers r-lib#297, and fixes domain for atanh
pearsonca added a commit to pearsonca/scales that referenced this issue Nov 2, 2023
answers r-lib#297, and fixes domain for atanh
@thomasp85
Copy link
Member

Fixed by #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants