{"action":"created","issue":{"url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2733","repository_url":"https://api.github.com/repos/tidyverse/ggplot2","labels_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2733/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2733/comments","events_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2733/events","html_url":"https://github.com/tidyverse/ggplot2/issues/2733","id":338825004,"node_id":"MDU6SXNzdWUzMzg4MjUwMDQ=","number":2733,"title":"position_nudge does not work with geom_boxplot","user":{"login":"jpasquier","id":752507,"node_id":"MDQ6VXNlcjc1MjUwNw==","avatar_url":"https://avatars3.githubusercontent.com/u/752507?v=4","gravatar_id":"","url":"https://api.github.com/users/jpasquier","html_url":"https://github.com/jpasquier","followers_url":"https://api.github.com/users/jpasquier/followers","following_url":"https://api.github.com/users/jpasquier/following{/other_user}","gists_url":"https://api.github.com/users/jpasquier/gists{/gist_id}","starred_url":"https://api.github.com/users/jpasquier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpasquier/subscriptions","organizations_url":"https://api.github.com/users/jpasquier/orgs","repos_url":"https://api.github.com/users/jpasquier/repos","events_url":"https://api.github.com/users/jpasquier/events{/privacy}","received_events_url":"https://api.github.com/users/jpasquier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-06T06:50:43Z","updated_at":"2018-07-06T13:18:32Z","closed_at":null,"author_association":"NONE","body":"position_nudge seems to not not work with geom_boxplot\r\n\r\n```r\r\nlibrary(ggplot2)\r\ndf <- data.frame(x = factor(\"x\"), y = 1:10)\r\nggplot(df, aes(x = x, y = y)) +\r\n  geom_boxplot(position = position_nudge(x = -0.2, y = 0))\r\n#> Error: position_nudge requires the following missing aesthetics: y\r\n```\r\n\r\nWhat I want to do eventually, is to place a dotplot next to a  boxplot like on this image\r\n![tmp](https://user-images.githubusercontent.com/752507/42363581-7b8732d0-80f8-11e8-892d-43747bb4972e.png)\r\n(I manage to produce this image with ggplot2. Oddly, this issue does not occur with some data. That is why I am completely lost...)\r\n\r\nI use R 3.5.1 with ggplot2 3.0.0 on debian stretch. The reproducible example was made with reprex.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/tidyverse/ggplot2/issues/comments/403031624","html_url":"https://github.com/tidyverse/ggplot2/issues/2733#issuecomment-403031624","issue_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2733","id":403031624,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzAzMTYyNA==","user":{"login":"clauswilke","id":4210929,"node_id":"MDQ6VXNlcjQyMTA5Mjk=","avatar_url":"https://avatars2.githubusercontent.com/u/4210929?v=4","gravatar_id":"","url":"https://api.github.com/users/clauswilke","html_url":"https://github.com/clauswilke","followers_url":"https://api.github.com/users/clauswilke/followers","following_url":"https://api.github.com/users/clauswilke/following{/other_user}","gists_url":"https://api.github.com/users/clauswilke/gists{/gist_id}","starred_url":"https://api.github.com/users/clauswilke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clauswilke/subscriptions","organizations_url":"https://api.github.com/users/clauswilke/orgs","repos_url":"https://api.github.com/users/clauswilke/repos","events_url":"https://api.github.com/users/clauswilke/events{/privacy}","received_events_url":"https://api.github.com/users/clauswilke/received_events","type":"User","site_admin":false},"created_at":"2018-07-06T13:18:32Z","updated_at":"2018-07-06T13:18:32Z","author_association":"COLLABORATOR","body":"I can confirm this. Simplified reprex below. For one data set the `y` aesthetic makes it all the way into the final data frame and for the other it doesn't. I can't see yet what triggers this.\r\n\r\n``` r\r\nlibrary(ggplot2)\r\ndf1 <- data.frame(\r\n  x = factor(c(\"3m\", \"1d\", \"6w\", \"24m\", \"preop\", \"12m\", \"6m\",\r\n               \"1d\", \"3m\", \"3m\", \"1d\", \"3m\", \"1d\", \"1d\", \"3w\",\r\n               \"3w\", \"12m\", \"preop\", \"3m\", \"preop\"),\r\n             levels = c(\"preop\", \"1d\", \"3w\", \"6w\", \"3m\", \"6m\",\r\n                        \"12m\", \"24m\")),\r\n  y = c(10, 13, 12, 11, 21, 16, 12, 4, 12, 13, 15, 7, 12,\r\n        15, 10, 16, 9, 18, 14, 30)\r\n)\r\n\r\ndf2 <- data.frame(\r\n  x = factor(c(\"preop\", \"3m\", \"1w\", \"1d\", \"1w\", \"3w\", \"1d\",\r\n               \"1d\", \"1w\", \"3m\", \"1d\", \"1w\", \"6m\", \"preop\",\r\n               \"6m\", \"6w\", \"6w\", \"preop\", \"3w\", \"6m\"),\r\n             levels = c(\"preop\", \"1d\", \"1w\", \"3w\", \"6w\",\r\n                        \"3m\", \"6m\")),\r\n  y = c(14, 10, 13, 12, 10, 11, 7, 14, 15, 18, 15, 9, 17,\r\n        26, 8, 8, 14, 23, 21, 13)\r\n)\r\n\r\nlayer_data(ggplot(df1, aes(x = x, y = y)) + geom_boxplot())\r\n#>   ymin lower middle upper ymax outliers notchupper notchlower x PANEL\r\n#> 1   18 19.50   21.0 25.50   30            26.47328  15.526719 1     1\r\n#> 2   12 12.00   13.0 15.00   15        4   15.11979  10.880208 2     1\r\n#> 3   10 11.50   13.0 14.50   16            16.35169   9.648314 3     1\r\n#> 4   12 12.00   12.0 12.00   12            12.00000  12.000000 4     1\r\n#> 5    7 10.00   12.0 13.00   14            14.11979   9.880208 5     1\r\n#> 6   12 12.00   12.0 12.00   12            12.00000  12.000000 6     1\r\n#> 7    9 10.75   12.5 14.25   16            16.41030   8.589700 7     1\r\n#> 8   11 11.00   11.0 11.00   11            11.00000  11.000000 8     1\r\n#>   group  y ymin_final ymax_final  xmin  xmax xid newx new_width weight\r\n#> 1     1 NA         18         30 0.625 1.375   1    1      0.75      1\r\n#> 2     2 NA          4         15 1.625 2.375   2    2      0.75      1\r\n#> 3     3 NA         10         16 2.625 3.375   3    3      0.75      1\r\n#> 4     4 12         12         12 3.625 4.375   4    4      0.75      1\r\n#> 5     5 NA          7         14 4.625 5.375   5    5      0.75      1\r\n#> 6     6 12         12         12 5.625 6.375   6    6      0.75      1\r\n#> 7     7 NA          9         16 6.625 7.375   7    7      0.75      1\r\n#> 8     8 11         11         11 7.625 8.375   8    8      0.75      1\r\n#>   colour  fill size alpha shape linetype\r\n#> 1 grey20 white  0.5    NA    19    solid\r\n#> 2 grey20 white  0.5    NA    19    solid\r\n#> 3 grey20 white  0.5    NA    19    solid\r\n#> 4 grey20 white  0.5    NA    19    solid\r\n#> 5 grey20 white  0.5    NA    19    solid\r\n#> 6 grey20 white  0.5    NA    19    solid\r\n#> 7 grey20 white  0.5    NA    19    solid\r\n#> 8 grey20 white  0.5    NA    19    solid\r\nlayer_data(ggplot(df2, aes(x = x, y = y)) + geom_boxplot())\r\n#>   ymin lower middle upper ymax outliers notchupper notchlower x PANEL\r\n#> 1   14 18.50   23.0 24.50   26            28.47328  17.526719 1     1\r\n#> 2    7 10.75   13.0 14.25   15            15.76500  10.235000 2     1\r\n#> 3    9  9.75   11.5 13.50   15            14.46250   8.537500 3     1\r\n#> 4   11 13.50   16.0 18.50   21            21.58614  10.413856 4     1\r\n#> 5    8  9.50   11.0 12.50   14            14.35169   7.648314 5     1\r\n#> 6   10 12.00   14.0 16.00   18            18.46891   9.531085 6     1\r\n#> 7    8 10.50   13.0 15.00   17            17.10496   8.895040 7     1\r\n#>   group ymin_final ymax_final  xmin  xmax xid newx new_width weight colour\r\n#> 1     1         14         26 0.625 1.375   1    1      0.75      1 grey20\r\n#> 2     2          7         15 1.625 2.375   2    2      0.75      1 grey20\r\n#> 3     3          9         15 2.625 3.375   3    3      0.75      1 grey20\r\n#> 4     4         11         21 3.625 4.375   4    4      0.75      1 grey20\r\n#> 5     5          8         14 4.625 5.375   5    5      0.75      1 grey20\r\n#> 6     6         10         18 5.625 6.375   6    6      0.75      1 grey20\r\n#> 7     7          8         17 6.625 7.375   7    7      0.75      1 grey20\r\n#>    fill size alpha shape linetype\r\n#> 1 white  0.5    NA    19    solid\r\n#> 2 white  0.5    NA    19    solid\r\n#> 3 white  0.5    NA    19    solid\r\n#> 4 white  0.5    NA    19    solid\r\n#> 5 white  0.5    NA    19    solid\r\n#> 6 white  0.5    NA    19    solid\r\n#> 7 white  0.5    NA    19    solid\r\n\r\nggplot(df1, aes(x = x, y = y)) +\r\n  geom_boxplot(position = position_nudge(x = -0.2))\r\n```\r\n\r\n![](https://i.imgur.com/V4qH52E.png)\r\n\r\n``` r\r\n\r\nggplot(df2, aes(x = x, y = y)) +\r\n  geom_boxplot(position = position_nudge(x = -0.2))\r\n#> Error: position_nudge requires the following missing aesthetics: y\r\n```\r\n\r\n![](https://i.imgur.com/ygoV4Rm.png)\r\n\r\nCreated on 2018-07-06 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0)."}}
{"actor":{"display_login":"clauswilke"}}