hadley/ggplot2 — Issue #261: Error if axis breaks go out of range
Author: wch
Created: 2011-11-15 01:29:52+00:00
State: open

In the devel branch, ggplot gives an error if the breaks on an axis go out of the plotting range.

```
dat <- data.frame(x=1:3, y=1:3)

# All breaks within range: OK
ggplot(dat, aes(x=x,y=y)) + geom_point() +
scale_y_continuous(breaks=1:3, labels=1:3)

# Breaks go out of range: not OK
ggplot(dat, aes(x=x,y=y)) + geom_point() +
scale_y_continuous(breaks=1:4, labels=1:4)
# Error in scale_labels.continuous(scale) :
# Breaks and labels are different lengths
```

This can cause problems in cases where you want tell it to make tick marks, say, every 10, without being super careful about the actual range shown in the graph. This happens especially when there are manually-specified labels to go with the breaks.

I believe the release version didn't have this issue.