{"action":"created","comment":{"url":"https://api.github.com/repos/hadley/ggplot2/pulls/comments/32748192","id":32748192,"diff_hunk":"@@ -239,17 +258,85 @@ facet_render.grid <- function(facet, panel, coord, theme, geom_grobs) {\n   strips$r$heights <- panels$heights\n   strips$t$widths <- panels$widths\n \n+  # Check if switch is consistent with grid layout\n+  switch_x <- !is.null(facet$switch) && facet$switch %in% c(\"both\", \"x\")\n+  switch_y <- !is.null(facet$switch) && facet$switch %in% c(\"both\", \"y\")\n+  if (switch_x && length(strips$t) == 0) {\n+    facet$switch <- if (facet$switch == \"both\") \"y\" else NULL\n+    switch_x <- FALSE\n+    message(\"Cannot switch x axis strips as they do not exist\")","path":"R/facet-grid-.r","position":57,"original_position":57,"commit_id":"c6583c1e6e98755cfb16f68bc8614de2dd50f673","original_commit_id":"c6583c1e6e98755cfb16f68bc8614de2dd50f673","user":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"body":"To me, it feels like this should either be silent or a warning","created_at":"2015-06-18T16:17:03Z","updated_at":"2015-06-18T16:17:03Z","html_url":"https://github.com/hadley/ggplot2/pull/974#discussion_r32748192","pull_request_url":"https://api.github.com/repos/hadley/ggplot2/pulls/974","_links":{"self":{"href":"https://api.github.com/repos/hadley/ggplot2/pulls/comments/32748192"},"html":{"href":"https://github.com/hadley/ggplot2/pull/974#discussion_r32748192"},"pull_request":{"href":"https://api.github.com/repos/hadley/ggplot2/pulls/974"}}},"pull_request":{"url":"https://api.github.com/repos/hadley/ggplot2/pulls/974","id":17150793,"html_url":"https://github.com/hadley/ggplot2/pull/974","diff_url":"https://github.com/hadley/ggplot2/pull/974.diff","patch_url":"https://github.com/hadley/ggplot2/pull/974.patch","issue_url":"https://api.github.com/repos/hadley/ggplot2/issues/974","number":974,"state":"open","locked":false,"title":"Facet titles","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},"body":"This implements a `switch_strips` argument to `facet_wrap` and `facet_grid`, which can be set to `x`, `y` or `both` (the latter only for grids). This allows to display the facet strips near the axes. They then act as axes subtitles. The padding between the switched strips and their corresponding axes can be adjusted through a new theme setting.\r\n\r\nDisplaying the facet titles near the axes especially makes sense when the facet title directly characterize a change in the axis (for example, a transformation, a different measure, etc). This should be typically used in conjunction with a theme without boxes around the strips. I go over this in the updated documentation.\r\n\r\nA grid facetting with strips switched to both axes:\r\n![facet1](https://cloud.githubusercontent.com/assets/4465050/3280482/1c1e20c4-f466-11e3-8718-a9dcbd88b551.png)\r\n\r\nA wrap facetting with free scales and strips switched to the x axis:\r\n![facet2](https://cloud.githubusercontent.com/assets/4465050/3280481/1c1dcd0e-f466-11e3-9ae3-403ca7b3d9a3.png)\r\n","created_at":"2014-06-15T08:24:17Z","updated_at":"2015-06-18T16:17:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b8eeaa0b2ffd22de811e5c6d73b037757c30f5a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hadley/ggplot2/pulls/974/commits","review_comments_url":"https://api.github.com/repos/hadley/ggplot2/pulls/974/comments","review_comment_url":"https://api.github.com/repos/hadley/ggplot2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hadley/ggplot2/issues/974/comments","statuses_url":"https://api.github.com/repos/hadley/ggplot2/statuses/c6583c1e6e98755cfb16f68bc8614de2dd50f673","head":{"label":"lionel-:facet-titles","ref":"facet-titles","sha":"c6583c1e6e98755cfb16f68bc8614de2dd50f673","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},"repo":{"id":20359271,"name":"ggplot2","full_name":"lionel-/ggplot2","owner":{"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},"private":false,"html_url":"https://github.com/lionel-/ggplot2","description":"An implementation of the Grammar of Graphics in R","fork":true,"url":"https://api.github.com/repos/lionel-/ggplot2","forks_url":"https://api.github.com/repos/lionel-/ggplot2/forks","keys_url":"https://api.github.com/repos/lionel-/ggplot2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lionel-/ggplot2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lionel-/ggplot2/teams","hooks_url":"https://api.github.com/repos/lionel-/ggplot2/hooks","issue_events_url":"https://api.github.com/repos/lionel-/ggplot2/issues/events{/number}","events_url":"https://api.github.com/repos/lionel-/ggplot2/events","assignees_url":"https://api.github.com/repos/lionel-/ggplot2/assignees{/user}","branches_url":"https://api.github.com/repos/lionel-/ggplot2/branches{/branch}","tags_url":"https://api.github.com/repos/lionel-/ggplot2/tags","blobs_url":"https://api.github.com/repos/lionel-/ggplot2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lionel-/ggplot2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lionel-/ggplot2/git/refs{/sha}","trees_url":"https://api.github.com/repos/lionel-/ggplot2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lionel-/ggplot2/statuses/{sha}","languages_url":"https://api.github.com/repos/lionel-/ggplot2/languages","stargazers_url":"https://api.github.com/repos/lionel-/ggplot2/stargazers","contributors_url":"https://api.github.com/repos/lionel-/ggplot2/contributors","subscribers_url":"https://api.github.com/repos/lionel-/ggplot2/subscribers","subscription_url":"https://api.github.com/repos/lionel-/ggplot2/subscription","commits_url":"https://api.github.com/repos/lionel-/ggplot2/commits{/sha}","git_commits_url":"https://api.github.com/repos/lionel-/ggplot2/git/commits{/sha}","comments_url":"https://api.github.com/repos/lionel-/ggplot2/comments{/number}","issue_comment_url":"https://api.github.com/repos/lionel-/ggplot2/issues/comments{/number}","contents_url":"https://api.github.com/repos/lionel-/ggplot2/contents/{+path}","compare_url":"https://api.github.com/repos/lionel-/ggplot2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lionel-/ggplot2/merges","archive_url":"https://api.github.com/repos/lionel-/ggplot2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lionel-/ggplot2/downloads","issues_url":"https://api.github.com/repos/lionel-/ggplot2/issues{/number}","pulls_url":"https://api.github.com/repos/lionel-/ggplot2/pulls{/number}","milestones_url":"https://api.github.com/repos/lionel-/ggplot2/milestones{/number}","notifications_url":"https://api.github.com/repos/lionel-/ggplot2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lionel-/ggplot2/labels{/name}","releases_url":"https://api.github.com/repos/lionel-/ggplot2/releases{/id}","created_at":"2014-05-31T16:00:03Z","updated_at":"2014-10-03T16:08:04Z","pushed_at":"2015-06-16T21:44:04Z","git_url":"git://github.com/lionel-/ggplot2.git","ssh_url":"git@github.com:lionel-/ggplot2.git","clone_url":"https://github.com/lionel-/ggplot2.git","svn_url":"https://github.com/lionel-/ggplot2","homepage":"http://ggplot2.org","size":18133,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hadley:master","ref":"master","sha":"f9a3e40171691112598761bd1efa5b35d059443c","user":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"repo":{"id":19438,"name":"ggplot2","full_name":"hadley/ggplot2","owner":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hadley/ggplot2","description":"An implementation of the Grammar of Graphics in R","fork":false,"url":"https://api.github.com/repos/hadley/ggplot2","forks_url":"https://api.github.com/repos/hadley/ggplot2/forks","keys_url":"https://api.github.com/repos/hadley/ggplot2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hadley/ggplot2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hadley/ggplot2/teams","hooks_url":"https://api.github.com/repos/hadley/ggplot2/hooks","issue_events_url":"https://api.github.com/repos/hadley/ggplot2/issues/events{/number}","events_url":"https://api.github.com/repos/hadley/ggplot2/events","assignees_url":"https://api.github.com/repos/hadley/ggplot2/assignees{/user}","branches_url":"https://api.github.com/repos/hadley/ggplot2/branches{/branch}","tags_url":"https://api.github.com/repos/hadley/ggplot2/tags","blobs_url":"https://api.github.com/repos/hadley/ggplot2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hadley/ggplot2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hadley/ggplot2/git/refs{/sha}","trees_url":"https://api.github.com/repos/hadley/ggplot2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hadley/ggplot2/statuses/{sha}","languages_url":"https://api.github.com/repos/hadley/ggplot2/languages","stargazers_url":"https://api.github.com/repos/hadley/ggplot2/stargazers","contributors_url":"https://api.github.com/repos/hadley/ggplot2/contributors","subscribers_url":"https://api.github.com/repos/hadley/ggplot2/subscribers","subscription_url":"https://api.github.com/repos/hadley/ggplot2/subscription","commits_url":"https://api.github.com/repos/hadley/ggplot2/commits{/sha}","git_commits_url":"https://api.github.com/repos/hadley/ggplot2/git/commits{/sha}","comments_url":"https://api.github.com/repos/hadley/ggplot2/comments{/number}","issue_comment_url":"https://api.github.com/repos/hadley/ggplot2/issues/comments{/number}","contents_url":"https://api.github.com/repos/hadley/ggplot2/contents/{+path}","compare_url":"https://api.github.com/repos/hadley/ggplot2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hadley/ggplot2/merges","archive_url":"https://api.github.com/repos/hadley/ggplot2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hadley/ggplot2/downloads","issues_url":"https://api.github.com/repos/hadley/ggplot2/issues{/number}","pulls_url":"https://api.github.com/repos/hadley/ggplot2/pulls{/number}","milestones_url":"https://api.github.com/repos/hadley/ggplot2/milestones{/number}","notifications_url":"https://api.github.com/repos/hadley/ggplot2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hadley/ggplot2/labels{/name}","releases_url":"https://api.github.com/repos/hadley/ggplot2/releases{/id}","created_at":"2008-05-25T01:21:32Z","updated_at":"2015-06-17T19:39:54Z","pushed_at":"2015-06-18T16:13:03Z","git_url":"git://github.com/hadley/ggplot2.git","ssh_url":"git@github.com:hadley/ggplot2.git","clone_url":"https://github.com/hadley/ggplot2.git","svn_url":"https://github.com/hadley/ggplot2","homepage":"http://ggplot2.org","size":21071,"stargazers_count":1317,"watchers_count":1317,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":445,"mirror_url":null,"open_issues_count":29,"forks":445,"open_issues":29,"watchers":1317,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hadley/ggplot2/pulls/974"},"html":{"href":"https://github.com/hadley/ggplot2/pull/974"},"issue":{"href":"https://api.github.com/repos/hadley/ggplot2/issues/974"},"comments":{"href":"https://api.github.com/repos/hadley/ggplot2/issues/974/comments"},"review_comments":{"href":"https://api.github.com/repos/hadley/ggplot2/pulls/974/comments"},"review_comment":{"href":"https://api.github.com/repos/hadley/ggplot2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hadley/ggplot2/pulls/974/commits"},"statuses":{"href":"https://api.github.com/repos/hadley/ggplot2/statuses/c6583c1e6e98755cfb16f68bc8614de2dd50f673"}}}}