{"action":"opened","issue":{"url":"https://api.github.com/repos/hadley/ggplot2/issues/1821","repository_url":"https://api.github.com/repos/hadley/ggplot2","labels_url":"https://api.github.com/repos/hadley/ggplot2/issues/1821/labels{/name}","comments_url":"https://api.github.com/repos/hadley/ggplot2/issues/1821/comments","events_url":"https://api.github.com/repos/hadley/ggplot2/issues/1821/events","html_url":"https://github.com/hadley/ggplot2/issues/1821","id":180935498,"number":1821,"title":"bug: geom_text in middle of stacked bar_plot not in the middle (v2.1.0.9001)","user":{"login":"dapper2dan","id":1423562,"avatar_url":"https://avatars.githubusercontent.com/u/1423562?v=3","gravatar_id":"","url":"https://api.github.com/users/dapper2dan","html_url":"https://github.com/dapper2dan","followers_url":"https://api.github.com/users/dapper2dan/followers","following_url":"https://api.github.com/users/dapper2dan/following{/other_user}","gists_url":"https://api.github.com/users/dapper2dan/gists{/gist_id}","starred_url":"https://api.github.com/users/dapper2dan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dapper2dan/subscriptions","organizations_url":"https://api.github.com/users/dapper2dan/orgs","repos_url":"https://api.github.com/users/dapper2dan/repos","events_url":"https://api.github.com/users/dapper2dan/events{/privacy}","received_events_url":"https://api.github.com/users/dapper2dan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-04T16:02:12Z","updated_at":"2016-10-04T16:02:12Z","closed_at":null,"body":"The placement of geom_text in the middle of a stacked bar_plot is off. When I run the example from the help file of `geom_text` I get:\r\n\r\n```r\r\ndf <- data.frame(\r\n  x = factor(c(1, 1, 2, 2)),\r\n  y = c(1, 3, 2, 1),\r\n  grp = c(\"a\", \"b\", \"a\", \"b\")\r\n)\r\n\r\ndf <- transform(df, mid_y = ave(df$y, df$x, FUN = function(val) cumsum(val) - (0.5 * val)))\r\n\r\nggplot(data = df, aes(x, y, fill = grp, label = y)) +\r\n  geom_col() +\r\n  geom_text(aes(y = mid_y))\r\n```\r\n\r\n![stacked_text](https://cloud.githubusercontent.com/assets/1423562/19081941/65229a8c-8a5c-11e6-86da-13581e88c822.png)\r\n\r\n\r\nI suppose this is [due to](https://blog.rstudio.org/2016/09/30/ggplot2-2-2-0-coming-soon/) \"`position_stack()` and `position_fill()` now stack values in the reverse order of the grouping, which makes the default stack order match the legend.\""}}
{"actor":{"display_login":"dapper2dan"}}