{"issue":{"state":"open","created_at":"2011-12-14T08:42:57Z","updated_at":"2011-12-15T13:04:18Z","user":{"gravatar_id":"3984cd736dbbb0a76fcdb7c5aa087f45","id":86978,"url":"https://api.github.com/users/wch","avatar_url":"https://secure.gravatar.com/avatar/3984cd736dbbb0a76fcdb7c5aa087f45?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"wch"},"comments":4,"body":"Setting `breaks=NA` on a continuous x or y axis results in an error.\r\n\r\n```R\r\ndat <- data.frame(x=1:3, y=1:3)\r\n\r\nggplot(dat, aes(x=x, y=y)) + geom_point() + scale_x_continuous(breaks=NA)\r\n# Error in if (max(limits) > max(b)) b <- c(b, b[length(b)] + bd) : \r\n#   missing value where TRUE/FALSE needed\r\n# In addition: Warning message:\r\n# In min(b) : no non-missing arguments to min; returning Inf\r\n```\r\n\r\nIt looks like the problem is in the calculation of minor breaks, at line 296 in `scale-.r`.\r\n\r\n\r\nHere's some skeleton test code for testing that continuous scales in general work with `breaks=NA`. It's skeleton because I don't know exactly what to `expect`. \r\n\r\n```R\r\ntest_that('Continuous scales work with breaks=NA', {\r\n  dat <- data.frame(x=1:3, y=1:3)\r\n\r\n  px <- ggplot(dat, aes(x=x, y=y)) + geom_point() + scale_x_continuous(breaks=NA)\r\n  bx <- ggplot_build(px)\r\n  # Needs to be fleshed out: With p$panel$ranges[[1]], should x.major be NULL or have NA?\r\n  expect_identical(\"???\", NA)\r\n  \r\n  py <- ggplot_build(ggplot(dat, aes(x=x, y=y)) + geom_point() + scale_y_continuous(breaks=NA))\r\n  by <- ggplot_build(py)\r\n\r\n  # Other continuous scales\r\n  pcolour <- ggplot(dat, aes(x=1, y=y, colour=x)) + geom_point() + scale_colour_continuous(breaks=NA)\r\n  bcolour <- ggplot_build(pcolour)\r\n  # expect??\r\n\r\n  pfill <- ggplot(dat, aes(x=1, y=y, fill=x)) + geom_point(shape=21) + scale_fill_continuous(breaks=NA)\r\n  bfill <- ggplot_build(pfill)\r\n  \r\n  palpha <- ggplot(dat, aes(x=1, y=y, alpha=x)) + geom_point() + scale_alpha_continuous(breaks=NA)\r\n  balpha <- ggplot_build(palpha)\r\n\r\n  psize <- ggplot(dat, aes(x=1, y=y, size=x)) + geom_point() + scale_size_continuous(breaks=NA)\r\n  bsize <- ggplot_build(psize)\r\n})\r\n```\r\nIt appears that some of these can't be built with ggplot_build (x and y), some can be built but not rendered (alpha, size), and others build and render fine (colour, fill).\r\n","assignee":null,"id":2548928,"labels":[],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":297,"title":"Setting breaks=NA on a continuous x or y axis results in error","html_url":"https://github.com/hadley/ggplot2/issues/297","closed_at":null,"milestone":{"state":"open","created_at":"2011-08-15T10:23:47Z","due_on":null,"closed_issues":18,"creator":{"gravatar_id":"7ba164f40a50bc23dbb2aa825fb7bc16","id":4196,"url":"https://api.github.com/users/hadley","avatar_url":"https://secure.gravatar.com/avatar/7ba164f40a50bc23dbb2aa825fb7bc16?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"hadley"},"number":1,"description":"","title":"0.9","url":"https://api.github.com/repos/hadley/ggplot2/milestones/1","open_issues":14},"url":"https://api.github.com/repos/hadley/ggplot2/issues/297"},"action":"created","comment":{"created_at":"2011-12-15T13:04:18Z","updated_at":"2011-12-15T13:04:18Z","user":{"gravatar_id":"7ba164f40a50bc23dbb2aa825fb7bc16","id":4196,"url":"https://api.github.com/users/hadley","avatar_url":"https://secure.gravatar.com/avatar/7ba164f40a50bc23dbb2aa825fb7bc16?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"hadley"},"body":"@koshke would you mind bundling your changes + the test into a pull request?  Thanks!","id":3160661,"url":"https://api.github.com/repos/hadley/ggplot2/issues/comments/3160661"}}