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

pseudo_log_trans does not respond to its base argument when in scale_*_continuous #400

Closed
kuriwaki opened this issue Sep 29, 2023 · 1 comment

Comments

@kuriwaki
Copy link

From the help page I would have thought the base argument in pseudo_log_trans changes things like log10 vs. natural log, but the reprex below shows that nothing changes when used in ggplot

library(scales)
library(tibble)
library(ggplot2)
library(patchwork)


dat <- tibble(y = c(0, 1, 100, 1e3, 1e4, 1e5, 1e6))

gg1 <- ggplot(dat) + geom_point(aes(y = y), x = 0.5) + 
  scale_y_continuous("pseudo log_e", trans = pseudo_log_trans(base = exp(1)))


gg2 <- ggplot(dat) + geom_point(aes(y = y), x = 0.5) + 
  scale_y_continuous("pseudo log10", trans = pseudo_log_trans(base = 10))


gg1 + gg2

Created on 2023-09-29 with reprex v2.0.2

However, the example in the help page does respond as intended to the argument: below, log(100) correctly becomes 2. So I think I'm not using pseudo_log_trans correctly in the scale_ functions?

library(scales)

plot(pseudo_log_trans(base = exp(1)), xlim = c(0, 100))

plot(pseudo_log_trans(base = 10), xlim = c(0, 100))

Created on 2023-09-29 with reprex v2.0.2

@kuriwaki
Copy link
Author

Never mind, this is the correct behavior since it's only changing the relative heights of the axis and not the values (log(100, base = 10)/log(10, base = 10) == log(100, base = 2)/log(10, base = 2))

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

No branches or pull requests

1 participant