Skip to content

On an error message when using scales #4241

Closed

Description

@iagogv3

I was using scale_x_date(labels=label_date("%d/%m/%Y")) for a data of class POSIXct so I got the error:

Error: Invalid input: date_trans works with objects of class Date only

Later I found the way to solve the error. The problem is that the message induces to think that the error is due to scales function label_date and not due to scale_x_date. I am not sure of this being the place to post this issue or the scales github or other place.

Minimal example:

last_month <- Sys.time() - 0:29
df <- data.frame(
  date = last_month,
  price = runif(30)
)
base <- ggplot(df, aes(date, price)) +
  geom_line()
base + scale_x_datetime(labels = label_date("%D")) # it works
base + scale_x_date(labels = label_date("%D")) # it does not work
Error: Invalid input: date_trans works with objects of class Date only

Thank you!

Activity

  1. clauswilke commented on Nov 19, 2020

    @clauswilke
    Member

    Closing this in favor of #4258.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions