-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Milestone
Description
Is the following expected behaviour? (scroll down to the last example, which fails)
df <- data.frame(
x_date = seq(as.Date("1952-01-01"), as.Date("2013-12-01"), by = "1 month"),
y = runif(12*62)
)
library('ggplot2')
library('scales')
p <- ggplot(df, aes(x_date, y)) + geom_point()
# version 1: automatic selection of start/end 'major' breaks
p + scale_x_date(labels = date_format("%Y"),
breaks = "5 years",
minor_breaks = "1 year")
# version 2: manual selection of start/end 'major' breaks
p + scale_x_date(labels = date_format("%Y"),
breaks = seq(as.Date("1950-01-01"),
as.Date("2015-01-01"),
by = "5 years"),
minor_breaks = "1 year")
# version 3: manual selection of start/end 'minor' breaks: FAIL
p + scale_x_date(labels = date_format("%Y"),
breaks = seq(as.Date("1950-01-01"),
as.Date("2015-01-01"),
by = "5 years"),
minor_breaks = seq(as.Date("1975-01-01"),
as.Date("1995-01-01"),
by = "1 year"))
## Error in Ops.Date((x - from[1]), diff(from)) :
## / not defined for "Date" objects
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior