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
scale_x_date limits not subsetting data #1090
Comments
Limits are automatically expanded using the expand parameter. |
Just to be clear, the limits of the scales are controlled by the expand parameter, but the limits of the data should not be affected. At least this is the behavior when using scale_x_continuous. Currently scale_x_date is functioning differently than scale_x_continuous. See below
With scale_x_continuous
with scale_x_date
|
Oh, hmmm, that's a more compelling bug. |
Here's a somewhat simpler reproducible example: library(ggplot2)
df <- data.frame(
x = as.Date("2000-01-01") + 0:50,
y = 1,
z = 0:50
)
ggplot(df, aes(x, y, colour = z >= 1)) +
geom_point()
ggplot(df, aes(x, y, colour = z >= 1)) +
geom_point() +
scale_x_date(limits = c(df$x[[2]], NA))
ggplot(df, aes(as.numeric(x), y, colour = z >= 1)) +
geom_point() +
scale_x_continuous(limits = c(df$x[[2]], NA)) |
Fixed in ae1303f |
Posted on Stack Overflow:
http://stackoverflow.com/questions/29900106/ggplot2-bug-ggplot-showing-not-dropping-data-outside-limits-of-scale#29900106
I've noticed that scale_x_date is displaying data outside of the limits specified in the scale. See example below. Why am I seeing points before 2009/01/01 and after 2015/01/01 in the graph if the limits are set to these values?
The text was updated successfully, but these errors were encountered: