Skip to content

coord_trans with continuous_scale and minor_breaks = NULL causes error #1422

@dbeltoft

Description

@dbeltoft

Hi

Noob here, apologize in advance if this is already known, or if I misunderstood a feature as a bug.

When trying to suppress minor breaks on my axis, while applying a coordinate transformation with coord_trans, I get an error. Here is a minimal example to reproduce the error:

library(ggplot2)
data <- data.frame(x = c(1,2,3), y = c(5,2,4))
ggplot(data, aes(x,y)) + 
  geom_point() +
  scale_x_continuous(minor_breaks = NULL) +
  coord_trans(xtrans = "log")                                  # This line causes the error
# Error in log(x, base) : non-numeric argument to mathematical function

Going through the traceback, it seems that transform_value does not check for NULL arguments, which makes it fail when trying to rescale the minor breaks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions