{"action":"created","comment":{"url":"https://api.github.com/repos/xray/xray/pulls/comments/36662318","id":36662318,"diff_hunk":"@@ -55,6 +55,17 @@ def _load_default_cmap(fname='default_colormap.csv'):\n     return LinearSegmentedColormap.from_list('viridis', cm_data)\n \n \n+def _title_for_slice(darray):\n+    '''\n+    If the dataarray comes from a slice we can show that info in the title\n+    '''\n+    title = []\n+    for key, value in darray.coords.items():\n+        if value.size == 1:","path":"xray/plot/plot.py","position":10,"original_position":10,"commit_id":"9f9aa5402c78ff368ba86507260c9384e273f936","original_commit_id":"9f9aa5402c78ff368ba86507260c9384e273f936","user":{"login":"clarkfitzg","id":5356122,"avatar_url":"https://avatars.githubusercontent.com/u/5356122?v=3","gravatar_id":"","url":"https://api.github.com/users/clarkfitzg","html_url":"https://github.com/clarkfitzg","followers_url":"https://api.github.com/users/clarkfitzg/followers","following_url":"https://api.github.com/users/clarkfitzg/following{/other_user}","gists_url":"https://api.github.com/users/clarkfitzg/gists{/gist_id}","starred_url":"https://api.github.com/users/clarkfitzg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarkfitzg/subscriptions","organizations_url":"https://api.github.com/users/clarkfitzg/orgs","repos_url":"https://api.github.com/users/clarkfitzg/repos","events_url":"https://api.github.com/users/clarkfitzg/events{/privacy}","received_events_url":"https://api.github.com/users/clarkfitzg/received_events","type":"User","site_admin":false},"body":"Yes. Here's a 4d array with a single size 1 coordinate:\r\n```\r\n  * dim_0    (dim_0) int64 0 1 2\r\n  * dim_1    (dim_1) int64 0 1 2 3\r\n  * dim_2    (dim_2) int64 0 1 2 3 4 5 6 7 8 9\r\n  * dim_3    (dim_3) int64 0\r\n\r\nIn [11]: _title_for_slice(b)\r\nOut[11]: 'dim_3 = [0]'\r\n\r\nIn [13]: _title_for_slice(b.isel(dim_1=2))\r\nOut[13]: 'dim_1 = 2, dim_3 = [0]'\r\n```\r\nIt shows square brackets around the value, since it's an array in this case.\r\n\r\nHowever, this won't come up in the current implementation since we don't allow 2d plots to work on say a 2 x 4 x 1 array:\r\n\r\n```\r\nIn [14]: b.isel(dim_1=2).plot.contourf()\r\n\r\n...\r\n\r\nValueError: contourf plots are for 2 dimensional DataArrays. Passed DataArray has 3 dimensions\r\n```\r\n\r\nI've thought about making this a special case and allowing it to plot. Thoughts?","created_at":"2015-08-10T17:56:06Z","updated_at":"2015-08-10T17:56:06Z","html_url":"https://github.com/xray/xray/pull/519#discussion_r36662318","pull_request_url":"https://api.github.com/repos/xray/xray/pulls/519","_links":{"self":{"href":"https://api.github.com/repos/xray/xray/pulls/comments/36662318"},"html":{"href":"https://github.com/xray/xray/pull/519#discussion_r36662318"},"pull_request":{"href":"https://api.github.com/repos/xray/xray/pulls/519"}}},"pull_request":{"url":"https://api.github.com/repos/xray/xray/pulls/519","id":41847648,"html_url":"https://github.com/xray/xray/pull/519","diff_url":"https://github.com/xray/xray/pull/519.diff","patch_url":"https://github.com/xray/xray/pull/519.patch","issue_url":"https://api.github.com/repos/xray/xray/issues/519","number":519,"state":"open","locked":false,"title":"2d plot titles","user":{"login":"clarkfitzg","id":5356122,"avatar_url":"https://avatars.githubusercontent.com/u/5356122?v=3","gravatar_id":"","url":"https://api.github.com/users/clarkfitzg","html_url":"https://github.com/clarkfitzg","followers_url":"https://api.github.com/users/clarkfitzg/followers","following_url":"https://api.github.com/users/clarkfitzg/following{/other_user}","gists_url":"https://api.github.com/users/clarkfitzg/gists{/gist_id}","starred_url":"https://api.github.com/users/clarkfitzg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarkfitzg/subscriptions","organizations_url":"https://api.github.com/users/clarkfitzg/orgs","repos_url":"https://api.github.com/users/clarkfitzg/repos","events_url":"https://api.github.com/users/clarkfitzg/events{/privacy}","received_events_url":"https://api.github.com/users/clarkfitzg/received_events","type":"User","site_admin":false},"body":"Working on faceted plotting now. This will be helpful. It adds a title if the array came from a slice, and labels the colorbar with the variable name.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/5356122/9125954/6c30206a-3c5b-11e5-8fd7-98c7ecd2ef0e.png)\r\n","created_at":"2015-08-06T23:53:00Z","updated_at":"2015-08-10T17:56:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4924cf8720642021d943c9fe36b52ec1ed51b4b8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/xray/xray/pulls/519/commits","review_comments_url":"https://api.github.com/repos/xray/xray/pulls/519/comments","review_comment_url":"https://api.github.com/repos/xray/xray/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xray/xray/issues/519/comments","statuses_url":"https://api.github.com/repos/xray/xray/statuses/9f9aa5402c78ff368ba86507260c9384e273f936","head":{"label":"xray:plot_title","ref":"plot_title","sha":"9f9aa5402c78ff368ba86507260c9384e273f936","user":{"login":"xray","id":7505795,"avatar_url":"https://avatars.githubusercontent.com/u/7505795?v=3","gravatar_id":"","url":"https://api.github.com/users/xray","html_url":"https://github.com/xray","followers_url":"https://api.github.com/users/xray/followers","following_url":"https://api.github.com/users/xray/following{/other_user}","gists_url":"https://api.github.com/users/xray/gists{/gist_id}","starred_url":"https://api.github.com/users/xray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xray/subscriptions","organizations_url":"https://api.github.com/users/xray/orgs","repos_url":"https://api.github.com/users/xray/repos","events_url":"https://api.github.com/users/xray/events{/privacy}","received_events_url":"https://api.github.com/users/xray/received_events","type":"Organization","site_admin":false},"repo":{"id":13221727,"name":"xray","full_name":"xray/xray","owner":{"login":"xray","id":7505795,"avatar_url":"https://avatars.githubusercontent.com/u/7505795?v=3","gravatar_id":"","url":"https://api.github.com/users/xray","html_url":"https://github.com/xray","followers_url":"https://api.github.com/users/xray/followers","following_url":"https://api.github.com/users/xray/following{/other_user}","gists_url":"https://api.github.com/users/xray/gists{/gist_id}","starred_url":"https://api.github.com/users/xray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xray/subscriptions","organizations_url":"https://api.github.com/users/xray/orgs","repos_url":"https://api.github.com/users/xray/repos","events_url":"https://api.github.com/users/xray/events{/privacy}","received_events_url":"https://api.github.com/users/xray/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xray/xray","description":"N-D labeled arrays and datasets in Python","fork":false,"url":"https://api.github.com/repos/xray/xray","forks_url":"https://api.github.com/repos/xray/xray/forks","keys_url":"https://api.github.com/repos/xray/xray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xray/xray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xray/xray/teams","hooks_url":"https://api.github.com/repos/xray/xray/hooks","issue_events_url":"https://api.github.com/repos/xray/xray/issues/events{/number}","events_url":"https://api.github.com/repos/xray/xray/events","assignees_url":"https://api.github.com/repos/xray/xray/assignees{/user}","branches_url":"https://api.github.com/repos/xray/xray/branches{/branch}","tags_url":"https://api.github.com/repos/xray/xray/tags","blobs_url":"https://api.github.com/repos/xray/xray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xray/xray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xray/xray/git/refs{/sha}","trees_url":"https://api.github.com/repos/xray/xray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xray/xray/statuses/{sha}","languages_url":"https://api.github.com/repos/xray/xray/languages","stargazers_url":"https://api.github.com/repos/xray/xray/stargazers","contributors_url":"https://api.github.com/repos/xray/xray/contributors","subscribers_url":"https://api.github.com/repos/xray/xray/subscribers","subscription_url":"https://api.github.com/repos/xray/xray/subscription","commits_url":"https://api.github.com/repos/xray/xray/commits{/sha}","git_commits_url":"https://api.github.com/repos/xray/xray/git/commits{/sha}","comments_url":"https://api.github.com/repos/xray/xray/comments{/number}","issue_comment_url":"https://api.github.com/repos/xray/xray/issues/comments{/number}","contents_url":"https://api.github.com/repos/xray/xray/contents/{+path}","compare_url":"https://api.github.com/repos/xray/xray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xray/xray/merges","archive_url":"https://api.github.com/repos/xray/xray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xray/xray/downloads","issues_url":"https://api.github.com/repos/xray/xray/issues{/number}","pulls_url":"https://api.github.com/repos/xray/xray/pulls{/number}","milestones_url":"https://api.github.com/repos/xray/xray/milestones{/number}","notifications_url":"https://api.github.com/repos/xray/xray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xray/xray/labels{/name}","releases_url":"https://api.github.com/repos/xray/xray/releases{/id}","created_at":"2013-09-30T17:21:10Z","updated_at":"2015-08-10T06:23:46Z","pushed_at":"2015-08-10T12:49:23Z","git_url":"git://github.com/xray/xray.git","ssh_url":"git@github.com:xray/xray.git","clone_url":"https://github.com/xray/xray.git","svn_url":"https://github.com/xray/xray","homepage":"http://xray.readthedocs.org","size":7656,"stargazers_count":230,"watchers_count":230,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":59,"mirror_url":null,"open_issues_count":77,"forks":59,"open_issues":77,"watchers":230,"default_branch":"master"}},"base":{"label":"xray:master","ref":"master","sha":"200aeb006781528cf6d4ca2f118d7f9257bd191b","user":{"login":"xray","id":7505795,"avatar_url":"https://avatars.githubusercontent.com/u/7505795?v=3","gravatar_id":"","url":"https://api.github.com/users/xray","html_url":"https://github.com/xray","followers_url":"https://api.github.com/users/xray/followers","following_url":"https://api.github.com/users/xray/following{/other_user}","gists_url":"https://api.github.com/users/xray/gists{/gist_id}","starred_url":"https://api.github.com/users/xray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xray/subscriptions","organizations_url":"https://api.github.com/users/xray/orgs","repos_url":"https://api.github.com/users/xray/repos","events_url":"https://api.github.com/users/xray/events{/privacy}","received_events_url":"https://api.github.com/users/xray/received_events","type":"Organization","site_admin":false},"repo":{"id":13221727,"name":"xray","full_name":"xray/xray","owner":{"login":"xray","id":7505795,"avatar_url":"https://avatars.githubusercontent.com/u/7505795?v=3","gravatar_id":"","url":"https://api.github.com/users/xray","html_url":"https://github.com/xray","followers_url":"https://api.github.com/users/xray/followers","following_url":"https://api.github.com/users/xray/following{/other_user}","gists_url":"https://api.github.com/users/xray/gists{/gist_id}","starred_url":"https://api.github.com/users/xray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xray/subscriptions","organizations_url":"https://api.github.com/users/xray/orgs","repos_url":"https://api.github.com/users/xray/repos","events_url":"https://api.github.com/users/xray/events{/privacy}","received_events_url":"https://api.github.com/users/xray/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xray/xray","description":"N-D labeled arrays and datasets in Python","fork":false,"url":"https://api.github.com/repos/xray/xray","forks_url":"https://api.github.com/repos/xray/xray/forks","keys_url":"https://api.github.com/repos/xray/xray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xray/xray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xray/xray/teams","hooks_url":"https://api.github.com/repos/xray/xray/hooks","issue_events_url":"https://api.github.com/repos/xray/xray/issues/events{/number}","events_url":"https://api.github.com/repos/xray/xray/events","assignees_url":"https://api.github.com/repos/xray/xray/assignees{/user}","branches_url":"https://api.github.com/repos/xray/xray/branches{/branch}","tags_url":"https://api.github.com/repos/xray/xray/tags","blobs_url":"https://api.github.com/repos/xray/xray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xray/xray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xray/xray/git/refs{/sha}","trees_url":"https://api.github.com/repos/xray/xray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xray/xray/statuses/{sha}","languages_url":"https://api.github.com/repos/xray/xray/languages","stargazers_url":"https://api.github.com/repos/xray/xray/stargazers","contributors_url":"https://api.github.com/repos/xray/xray/contributors","subscribers_url":"https://api.github.com/repos/xray/xray/subscribers","subscription_url":"https://api.github.com/repos/xray/xray/subscription","commits_url":"https://api.github.com/repos/xray/xray/commits{/sha}","git_commits_url":"https://api.github.com/repos/xray/xray/git/commits{/sha}","comments_url":"https://api.github.com/repos/xray/xray/comments{/number}","issue_comment_url":"https://api.github.com/repos/xray/xray/issues/comments{/number}","contents_url":"https://api.github.com/repos/xray/xray/contents/{+path}","compare_url":"https://api.github.com/repos/xray/xray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xray/xray/merges","archive_url":"https://api.github.com/repos/xray/xray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xray/xray/downloads","issues_url":"https://api.github.com/repos/xray/xray/issues{/number}","pulls_url":"https://api.github.com/repos/xray/xray/pulls{/number}","milestones_url":"https://api.github.com/repos/xray/xray/milestones{/number}","notifications_url":"https://api.github.com/repos/xray/xray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xray/xray/labels{/name}","releases_url":"https://api.github.com/repos/xray/xray/releases{/id}","created_at":"2013-09-30T17:21:10Z","updated_at":"2015-08-10T06:23:46Z","pushed_at":"2015-08-10T12:49:23Z","git_url":"git://github.com/xray/xray.git","ssh_url":"git@github.com:xray/xray.git","clone_url":"https://github.com/xray/xray.git","svn_url":"https://github.com/xray/xray","homepage":"http://xray.readthedocs.org","size":7656,"stargazers_count":230,"watchers_count":230,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":59,"mirror_url":null,"open_issues_count":77,"forks":59,"open_issues":77,"watchers":230,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xray/xray/pulls/519"},"html":{"href":"https://github.com/xray/xray/pull/519"},"issue":{"href":"https://api.github.com/repos/xray/xray/issues/519"},"comments":{"href":"https://api.github.com/repos/xray/xray/issues/519/comments"},"review_comments":{"href":"https://api.github.com/repos/xray/xray/pulls/519/comments"},"review_comment":{"href":"https://api.github.com/repos/xray/xray/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xray/xray/pulls/519/commits"},"statuses":{"href":"https://api.github.com/repos/xray/xray/statuses/9f9aa5402c78ff368ba86507260c9384e273f936"}}}}