Skip to content

On an error message when using scales #4241

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
iagogv3 opened this issue Oct 15, 2020 · 1 comment
Closed

On an error message when using scales #4241

iagogv3 opened this issue Oct 15, 2020 · 1 comment

Comments

@iagogv3
Copy link

iagogv3 commented Oct 15, 2020

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!

@clauswilke
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants