We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What I am trying to achieve:
Binned histograms rendered as Excel®-style grouped bar graphs, when the x axis is a timestamp.
This does exactly what I want when x is numeric:
ggplot(diamonds, aes(x = price, fill = cut)) + geom_bar(stat = "count", position = "dodge") + scale_x_binned()
The same approach doesn't work with POSIXct:
library(dplyr) library(lubridate) lakers %>% mutate(date = ymd(date)) %>% ggplot(aes(x = date, fill = game_type)) + geom_bar(stat = "count", position = "dodge") + scale_x_binned()
Error: Binned scales only support continuous data
“Casting” the x into an integer is tantalizing close to what I want:
lakers %>% mutate(date = ymd(date)) %>% ggplot( aes(x = int(date), # Emphasis mine fill = game_type)) + geom_bar(stat = "count", position = "dodge") + scale_x_binned()
... but of course, the labeling on the x axis could be better.
The text was updated successfully, but these errors were encountered:
Also,
lakers %>% mutate(date = as.Date(ymd(date))) %>% ggplot(aes(x = date, fill = game_type, width = 0.1)) + geom_bar(position = "dodge") + scale_x_binned(trans = "date")
Error: Invalid input: date_trans works with objects of class Date only
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
What I am trying to achieve:
Binned histograms rendered as Excel®-style grouped bar graphs, when the x axis is a timestamp.
This does exactly what I want when x is numeric:
The same approach doesn't work with POSIXct:
“Casting” the x into an integer is tantalizing close to what I want:
... but of course, the labeling on the x axis could be better.
The text was updated successfully, but these errors were encountered: