hadley/ggplot2 — Issue #421: coord_polar doesn't work when y limits clip high data
Author: wch
Created: 2012-02-29 23:10:49+00:00
State: open

When you set the y limits, it throws an error when high data is clipped. The error doesn't happen when low data is clipped, though.

```R
dat <- data.frame(x=rep(1:5),
y=c(1,2,10,3,4))

p <- ggplot(dat, aes(x=x, y=y)) + geom_line()

# OK: polar + automatic range
p + coord_polar()

# OK: polar + manual range that includes all data
p + coord_polar() + ylim(0,11)

# bad: polar + manual range that clips high data
p + coord_polar() + ylim(0,9)
#Error in data$y[data$y == -Inf] <- range$y.range[1] :
# replacement has length zero

# OK: polar + manual range that clips low data
p + coord_polar() + ylim(3,11)

# OK: not polar + manual range that clips high data
p + ylim(0,9)

# OK: not polar + manual range that clips low data
p + ylim(3,11)
```