Skip to content

Use of length 1 numeric vector for expand gives confusing error message #4140

@alanocallaghan

Description

@alanocallaghan

The error message when you supply a single numeric value to expand says that a single numeric value is okay, which seems a bit kafkaesque*

library("ggplot2")
ggplot(mtcars) +
  aes(mpg, cyl) +
  geom_point() +
  scale_y_continuous(expand=0)
# Error: `expand` must be a numeric vector with 1 or 2 elements
is.vector(0)
# [1] TRUE
is.numeric(0)
# [1] TRUE
length(0)
# [1] 1

*I confess, I've not read kafka so that's probably wrong, but it reminds me of that Asterix & Obelix cartoon with the forms

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorscales 🐍

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions