{"action":"opened","issue":{"url":"https://api.github.com/repos/hadley/ggplot2/issues/1577","repository_url":"https://api.github.com/repos/hadley/ggplot2","labels_url":"https://api.github.com/repos/hadley/ggplot2/issues/1577/labels{/name}","comments_url":"https://api.github.com/repos/hadley/ggplot2/issues/1577/comments","events_url":"https://api.github.com/repos/hadley/ggplot2/issues/1577/events","html_url":"https://github.com/hadley/ggplot2/issues/1577","id":139435465,"number":1577,"title":"stat_contour and geom_contour throwing errors when attempting to use z axis","user":{"login":"lazarillo","id":636798,"avatar_url":"https://avatars.githubusercontent.com/u/636798?v=3","gravatar_id":"","url":"https://api.github.com/users/lazarillo","html_url":"https://github.com/lazarillo","followers_url":"https://api.github.com/users/lazarillo/followers","following_url":"https://api.github.com/users/lazarillo/following{/other_user}","gists_url":"https://api.github.com/users/lazarillo/gists{/gist_id}","starred_url":"https://api.github.com/users/lazarillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lazarillo/subscriptions","organizations_url":"https://api.github.com/users/lazarillo/orgs","repos_url":"https://api.github.com/users/lazarillo/repos","events_url":"https://api.github.com/users/lazarillo/events{/privacy}","received_events_url":"https://api.github.com/users/lazarillo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-09T00:29:44Z","updated_at":"2016-03-09T00:29:44Z","closed_at":null,"body":"I also [submitted this via StackOverflow](http://bit.ly/1Yu01t5), since I wasn't 100% sure if the problem were user error or an actual problem with the code.\r\n\r\n-----\r\n\r\n# Successful Run\r\n\r\nIt's possible I do not understand the expectations, however, if I follow the example at [`stat_contour`'s documentation](http://docs.ggplot2.org/0.9.2.1/stat_contour.html), I successfully get:\r\n\r\n    # Generate data\r\n    library(reshape2) # for melt\r\n    volcano3d <- melt(volcano)\r\n    names(volcano3d) <- c(\"x\", \"y\", \"z\")\r\n\r\n    # Basic plot\r\n    v <- ggplot(volcano3d, aes(x, y, z = z))\r\n    v + stat_contour()\r\n\r\nleading to:\r\n\r\n[![proper stat_contour plot][1]][1]\r\n\r\n# Unsuccessful Run\r\n\r\nHowever, when I try to do what appears to be ***exactly the same thing with exactly the same data types***, I have errors:\r\n\r\n    my_plt <- ggplot(diamonds, aes(depth, carat, z=price))\r\n    my_plt + stat_contour()\r\n\r\nyields:\r\n\r\n    Warning message:\r\n    Computation failed in `stat_contour()`:\r\n    (list) object cannot be coerced to type 'double' \r\n\r\n# Debugging Attempt\r\n\r\nThe only potential difference I could imagine, especially with the error I was receiving, was an object type difference.  So, here are some details there:\r\n\r\n - `volcano3d`\r\n\r\n        head(volcano3d)\r\n\r\n          x y   z\r\n        1 1 1 100\r\n        2 2 1 101\r\n        3 3 1 102\r\n        4 4 1 103\r\n        5 5 1 104\r\n        6 6 1 105\r\n\r\n    And...\r\n\r\n        volcano3d %>% sapply(class)\r\n             x         y         z \r\n        \"integer\" \"integer\" \"numeric\" \r\n\r\n - `diamonds`\r\n\r\n        diamonds %>% select(depth, carat, price) %>% head\r\n        Source: local data frame [6 x 3]\r\n\r\n          depth carat price\r\n          (dbl) (dbl) (dbl)\r\n        1  61.5  0.23   326\r\n        2  59.8  0.21   326\r\n        3  56.9  0.23   327\r\n        4  62.4  0.29   334\r\n        5  63.3  0.31   335\r\n        6  62.8  0.24   336\r\n\r\n    And...\r\n\r\n        diamonds %>% select(depth, carat, price) %>% sapply(class)\r\n            depth     carat     price \r\n        \"numeric\" \"numeric\" \"numeric\" \r\n\r\nI cannot see any reason why I should be getting these errors.  Any ideas??\r\n\r\nThanks!\r\n\r\n\r\n  [1]: http://i.stack.imgur.com/GpHiR.png\r\n\r\n"}}