wresch / wresch.github.io

0 stars 0 forks source link

asinh scale with ggplot #1

Open SamGG opened 6 years ago

SamGG commented 6 years ago

Thanks for your code at http://wresch.github.io/2013/03/08/asinh-scales-in-ggplot2.html I modified it in order to take into negative values. IMHO, I feel this is better, but it can be improved. Cheers.

  br <- function(r) {
    lmin <- round(log10(abs(r[1]))) * sign(r[1])
    lmax <- round(log10(r[2]))
    lbreaks <- seq(lmin, lmax, by = 1)
    breaks <- 10 ^ lbreaks
  }
  p.rng <- range(x, na.rm = TRUE)
wresch commented 6 years ago

Hi @SamGG, sorry I took so long to reply. Thanks for your suggestion. And you are absolutely right - i only ever used this transformation for count data so i only paid minimal attention to negative values. I've been experimenting with the scale again and have some ideas. Once thing i did not realize is that the breaks function seems to get passed the untransformed range of the data, not the full data. That surprised me. Anyway, still playing around with a solution that looks pretty in most plots. Wolfgang

SamGG commented 6 years ago

Thanks for your feedback. Best.