Skip to content

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

Closed

Description

@yutannihilation

(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)

Activity

  1. added
    bug
    on Sep 6, 2020
  2. clauswilke commented on Sep 6, 2020

    @clauswilke
    Member

    This is a longstanding problem, I believe: #980

  3. yutannihilation commented on Sep 6, 2020

    @yutannihilation
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugscales 🐍

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions