Skip to content

Breaks misalignment with scale_x_date #814

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
jrowen opened this issue May 23, 2013 · 1 comment
Closed

Breaks misalignment with scale_x_date #814

jrowen opened this issue May 23, 2013 · 1 comment

Comments

@jrowen
Copy link

jrowen commented May 23, 2013

I'm seeing a misalignment between the major and minor breaks when they use different units.

df=data.frame(Date=seq(from=as.Date("2008-12-15"), 
                     to=as.Date("2013-04-30"), by="day"))
df$y=rnorm(nrow(df))

ggplot(df) +
  geom_path(aes(x=Date, y=y)) +
  scale_x_date(expand=c(0, 0), breaks=date_breaks("1 year"), 
               labels=date_format("%Y"),
               minor_breaks=date_breaks("3 months"))

If everything is defined using the same units, the breaks are aligned as expected, but in this example, the axis label marks the end, instead of beginning of the period.

ggplot(df) +
  geom_path(aes(x=Date, y=y)) +
  scale_x_date(expand=c(0, 0), breaks=date_breaks("12 months"), 
               labels=date_format("%Y"),
               minor_breaks=date_breaks("3 months"))
@hadley
Copy link
Member

hadley commented Feb 24, 2014

This sounds like a great feature/horrible bug, but unfortunately we don't currently have the development bandwidth to support it/fix it. If you'd like to submit a pull request that implements this feature/fixes this bug, please follow the instructions in the development vignette.

@hadley hadley closed this as completed Feb 24, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants