{"action":"closed","issue":{"url":"https://api.github.com/repos/hadley/ggplot2/issues/1299","labels_url":"https://api.github.com/repos/hadley/ggplot2/issues/1299/labels{/name}","comments_url":"https://api.github.com/repos/hadley/ggplot2/issues/1299/comments","events_url":"https://api.github.com/repos/hadley/ggplot2/issues/1299/events","html_url":"https://github.com/hadley/ggplot2/issues/1299","id":103622614,"number":1299,"title":"Flawed `label_bquote()` implementation","user":{"login":"lionel-","id":4465050,"avatar_url":"https://avatars.githubusercontent.com/u/4465050?v=3","gravatar_id":"","url":"https://api.github.com/users/lionel-","html_url":"https://github.com/lionel-","followers_url":"https://api.github.com/users/lionel-/followers","following_url":"https://api.github.com/users/lionel-/following{/other_user}","gists_url":"https://api.github.com/users/lionel-/gists{/gist_id}","starred_url":"https://api.github.com/users/lionel-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionel-/subscriptions","organizations_url":"https://api.github.com/users/lionel-/orgs","repos_url":"https://api.github.com/users/lionel-/repos","events_url":"https://api.github.com/users/lionel-/events{/privacy}","received_events_url":"https://api.github.com/users/lionel-/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-28T00:39:03Z","updated_at":"2015-10-12T21:37:45Z","closed_at":"2015-10-12T21:37:45Z","body":"I think the approach of referring to names in `label_bquote()` is flawed :(\r\n\r\nWith formulaes of the type `var1 ~ var2`, the labels are not sent simultaneously to the labeller but in turn. They are only sent together with `. ~ var1 + var2`. So this doesn't work:\r\n```r\r\np <- ggplot(mtcars, aes(wt, mpg)) + geom_point()\r\np + facet_grid(cyl ~ vs, labeller = label_bquote(alpha ^ .(cyl)))\r\n## Error: object 'cyl' not found\r\n```\r\n\r\nWe need to find another way. My first implementation created aliases `x`, `y` and `z` for the labels so that bquote would take expressions like `.(x) ^ .(y)`. This is a bit more general but this would still not work in case the number of facetted variables is not the same in both dimensions. Maybe the only way is to go back to a single `x` alias.\r\n\r\nOr, we could add an attribute to the labels data frames specifying from which facetting side the variables come from: columns or rows. `facet_wrap()` would send `cols` labels. Then `label_bquote()` could take `cols_expr` and `rows_expr` arguments, and when one of them is missing we fall back on `label_value()`. It actually makes more sense to allow different formulaes in each dimension.\r\n\r\nI'm away this weekend so I'll fix this next week"}}