Skip to content

Axis label on 0 disappears on scale_*_sqrt() #4193

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

Closed
yutannihilation opened this issue Sep 6, 2020 · 2 comments
Closed

Axis label on 0 disappears on scale_*_sqrt() #4193

yutannihilation opened this issue Sep 6, 2020 · 2 comments
Labels
bug an unexpected problem or unintended behavior scales 🐍

Comments

@yutannihilation
Copy link
Member

(Originally found #4155 (comment))

Probably something is wrong with backtransformation...? (I guess this is somehow related to the fact that the limits are expanded to the negative value, which doesn't exist in sqrt scale. But, still not sure why it also disappears when only the max is expanded.)

library(ggplot2)
library(patchwork)

d <- data.frame(value = 16)

f <- function(expand) {
  ggplot(d) +
    geom_point(aes(value, 0), colour = "red", size = 10) +
    scale_x_sqrt(limits = c(0, 16), breaks = c(0, 4, 16), expand = expand)
}

p1 <- f(c(0.1, 0.1)) + ggtitle("expand both (label disappears)")
p2 <- f(c(0, 0.1)) + ggtitle("expand max (label disappears)")
p3 <- f(c(0, 0)) + ggtitle("no expand (ok)")
p1 / p2 / p3

Created on 2020-09-06 by the reprex package (v0.3.0)

@clauswilke
Copy link
Member

This is a longstanding problem, I believe: #980

@yutannihilation
Copy link
Member Author

Oh, I didn't notice it, sorry...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior scales 🐍
Projects
None yet
Development

No branches or pull requests

2 participants