{"action":"created","issue":{"url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2876","repository_url":"https://api.github.com/repos/tidyverse/ggplot2","labels_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2876/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2876/comments","events_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2876/events","html_url":"https://github.com/tidyverse/ggplot2/issues/2876","id":356630899,"node_id":"MDU6SXNzdWUzNTY2MzA4OTk=","number":2876,"title":"All zero values with `scale_y_log10()` gives an error","user":{"login":"billdenney","id":10359931,"node_id":"MDQ6VXNlcjEwMzU5OTMx","avatar_url":"https://avatars1.githubusercontent.com/u/10359931?v=4","gravatar_id":"","url":"https://api.github.com/users/billdenney","html_url":"https://github.com/billdenney","followers_url":"https://api.github.com/users/billdenney/followers","following_url":"https://api.github.com/users/billdenney/following{/other_user}","gists_url":"https://api.github.com/users/billdenney/gists{/gist_id}","starred_url":"https://api.github.com/users/billdenney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billdenney/subscriptions","organizations_url":"https://api.github.com/users/billdenney/orgs","repos_url":"https://api.github.com/users/billdenney/repos","events_url":"https://api.github.com/users/billdenney/events{/privacy}","received_events_url":"https://api.github.com/users/billdenney/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-04T02:21:13Z","updated_at":"2018-09-12T12:49:40Z","closed_at":null,"author_association":"NONE","body":"When generating a figure with all zero values, `scale_y_log10()` gives an error instead of an empty plot.  I would have hoped for a figure with all the points along the bottom (ideally as it is similar to the typical result for log scales) or otherwise an empty plot (sub-optimal since it removes some information).\r\n\r\n``` r\r\nlibrary(ggplot2)\r\np <-\r\n  ggplot(data.frame(x=0, y=0), aes(x=x, y=y)) +\r\n  geom_point()\r\np\r\n```\r\n\r\n![](https://i.imgur.com/t2MPvOD.png)\r\n\r\n``` r\r\np + scale_y_log10()\r\n#> Warning: Transformation introduced infinite values in continuous y-axis\r\n#> Error in seq.default(min, max, by = by): 'from' must be a finite number\r\n```\r\n\r\n![](https://i.imgur.com/TskYOUo.png)\r\n\r\nCreated on 2018-09-03 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0).\r\n"},"comment":{"url":"https://api.github.com/repos/tidyverse/ggplot2/issues/comments/420635791","html_url":"https://github.com/tidyverse/ggplot2/issues/2876#issuecomment-420635791","issue_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2876","id":420635791,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDYzNTc5MQ==","user":{"login":"billdenney","id":10359931,"node_id":"MDQ6VXNlcjEwMzU5OTMx","avatar_url":"https://avatars1.githubusercontent.com/u/10359931?v=4","gravatar_id":"","url":"https://api.github.com/users/billdenney","html_url":"https://github.com/billdenney","followers_url":"https://api.github.com/users/billdenney/followers","following_url":"https://api.github.com/users/billdenney/following{/other_user}","gists_url":"https://api.github.com/users/billdenney/gists{/gist_id}","starred_url":"https://api.github.com/users/billdenney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billdenney/subscriptions","organizations_url":"https://api.github.com/users/billdenney/orgs","repos_url":"https://api.github.com/users/billdenney/repos","events_url":"https://api.github.com/users/billdenney/events{/privacy}","received_events_url":"https://api.github.com/users/billdenney/received_events","type":"User","site_admin":false},"created_at":"2018-09-12T12:49:40Z","updated_at":"2018-09-12T12:49:40Z","author_association":"NONE","body":"I think that this would be best fixed around here: https://github.com/tidyverse/ggplot2/blob/01155ba2e9394e17066668eace50c13354e03b3a/R/coord-cartesian-.r#L121\r\n\r\nI think that the change would be to check if the transformation yielded all infinite values prior to passing it to range, and if so add some nominal value to the range (like `scale$transform(1)`).\r\n\r\nThe alternate solution seems like it would be a check in `scales::log_breaks()` at the top if `all(x %in% c(Inf, 0, NA_real_))` then `rng <- c(0, 0)`."}}
{"actor":{"display_login":"billdenney"}}