-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Adding date_breaks to scale_*_time
#4335
Comments
I think the library(hms)
library(ggplot2
library(scales)
df <- data.frame(diff = as_hms(c(1850000, 800)), time = rep(Sys.time(), 2))
p <- ggplot(df) +
geom_point(aes(time, diff))
p + scale_y_time(
name = "Week",
breaks = breaks_width("1 week"),
labels = label_time("%W")
) p + scale_y_time(
name = "Days",
breaks = breaks_width("4 days"),
labels = label_time("%j")
) Created on 2022-12-03 by the reprex package (v2.0.1) |
I was not aware of this functions when I opened the issue, so this might solve the inmediat problem. However, it wouldn't be consistent with other time related |
Many thanks @teunbrand. I see now the argument name discussion. For the record, I don't mind much which name is used, if you find a better argument that would be good too (time_breaks, period_breaks?) |
The argument names are fine for consistency, which I think is more important than super-accurate argument names. However, if one were to rewrite the scales from scratch, I think it might have been best to allow |
I am working with a dataset where there are huge time differences.
If I use
scale_*_time
I cannot convert those labels to a more meaningful label such as 1 week, 2 weeks... as it can be done withscale_*_date*
. Could it be possible to add thedate_breaks
argument toscale_*_time
(or something similar)?This would make it easier to interpret the plots.
Couldn't find any issue related to this
The text was updated successfully, but these errors were encountered: