hadley/ggplot2 — Issue #408: Unexpected result instead of error when using a discrete position scale with continusous data
Author: jiho
Created: 2012-02-20 15:20:26+00:00
State: open

Given this continuous data

library("ggplot2")
set.seed(123)
d <- data.frame(x=runif(10), y=runif(10))
ggplot(d) + geom_point(aes(x=x, y=y))

I would expect these

ggplot(d) + geom_point(aes(x=x, y=y)) + scale_x_discrete(breaks=c(0,0.5,1))
ggplot(d) + geom_point(aes(x=x, y=y)) + scale_x_date()

to throw an error. Instead they do unexpected stuffL

- `scale_x_discrete` produces a axis with breaks at 0 and 1 only and leaves a lot of blank space on the right of 1
- `scale_x_date` produces a scale which depends on the current time