{"action":"created","comment":{"url":"https://api.github.com/repos/plotly/plotly.py/pulls/comments/45935749","id":45935749,"diff_hunk":"@@ -2509,6 +2561,205 @@ def create_dendrogram(X, orientation=\"bottom\", labels=None,\n         return {'layout': dendrogram.layout,\n                 'data': dendrogram.data}\n \n+    @staticmethod\n+    def create_annotated_heatmap(z, x=None, y=None, annotation_text=None,\n+                                 colorscale=None, fontcolor=None,\n+                                 showscale=False, reversescale=False,\n+                                 **kwargs):\n+        \"\"\"\n+        BETA function that creates annotated heatmaps\n+\n+        This functions adds annotations to each cell of the heatmap.\n+\n+        :param (list[list]) z: z matrix to create heatmap.\n+        :param (list) x: x axis labels.\n+        :param (list) y: y axis labels.\n+        :param (list[list]) text: Text strings for annotations. Should be the\n+            same dimmensions as the z matrix. If no text is added, the the\n+            values of the z matrix are annotated. Default = z matrix values.\n+        :param (list) fontcolor: List of two colorstrings: [min_text_color,\n+            max_text_color] where min_text_color is applied to annotations for\n+            heatmap values < (max_value - min_value)/2. If fontcolor is not\n+            defined the colors are defined logically as black or white\n+            depending on the heatmap's colorscale.\n+        :param (bool) showscale: Display colorscale. Default = False\n+        :param kwargs: kwargs passed through plotly.graph_objs.Heatmap.\n+            These kwargs describe other attributes about the annotated Heatmap\n+            trace such as the colorscale. For more information on valid kwargs\n+            call help(plotly.graph_objs.Heatmap)\n+\n+        Example 1: Simple annotated heatmap with default configuration\n+        ```\n+        import plotly.plotly as py\n+        from plotly.tools import FigureFactory as FF\n+\n+        z = [[0.300000, 0.00000, 0.65, 0.300000], \n+             [1, 0.100005, 0.45, 0.4300],\n+             [0.300000, 0.00000, 0.65, 0.300000],\n+             [1, 0.100005, 0.45, 0.00000]]\n+\n+        hm = FF.create_annotated_heatmap(z)\n+        py.iplot(hm)\n+        ```\n+        \"\"\"\n+        # TODO: protected until #282\n+        from plotly.graph_objs import graph_objs\n+\n+        # Avoiding mutables in the call signature\n+        colorscale = colorscale if colorscale is not None else 'RdBu'\n+        fontcolor = fontcolor if fontcolor is not None else []\n+        FigureFactory._validate_annotated_heatmap(z, annotation_text)\n+        annotations = _AnnotatedHeatmap(z, x, y, annotation_text,\n+                                        colorscale, fontcolor, reversescale,\n+                                        **kwargs).make_annotations()\n+\n+        if x or y:","path":"plotly/tools.py","position":153,"original_position":153,"commit_id":"27f8efa177b46cdbd3e7e91b2cd69584097a9f69","original_commit_id":"27f8efa177b46cdbd3e7e91b2cd69584097a9f69","user":{"login":"theengineear","id":6611546,"avatar_url":"https://avatars.githubusercontent.com/u/6611546?v=3","gravatar_id":"","url":"https://api.github.com/users/theengineear","html_url":"https://github.com/theengineear","followers_url":"https://api.github.com/users/theengineear/followers","following_url":"https://api.github.com/users/theengineear/following{/other_user}","gists_url":"https://api.github.com/users/theengineear/gists{/gist_id}","starred_url":"https://api.github.com/users/theengineear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theengineear/subscriptions","organizations_url":"https://api.github.com/users/theengineear/orgs","repos_url":"https://api.github.com/users/theengineear/repos","events_url":"https://api.github.com/users/theengineear/events{/privacy}","received_events_url":"https://api.github.com/users/theengineear/received_events","type":"User","site_admin":false},"body":"Doesn't seem like there's validation on the x and y values at this point, is there? If x or y are `0` or '' or `[]` (etc), this conditional will fall to the `else` block. Should we actually be failing on these cases to prevent strange bugs in the future?","created_at":"2015-11-26T01:01:40Z","updated_at":"2015-11-26T01:01:40Z","html_url":"https://github.com/plotly/plotly.py/pull/359#discussion_r45935749","pull_request_url":"https://api.github.com/repos/plotly/plotly.py/pulls/359","_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.py/pulls/comments/45935749"},"html":{"href":"https://github.com/plotly/plotly.py/pull/359#discussion_r45935749"},"pull_request":{"href":"https://api.github.com/repos/plotly/plotly.py/pulls/359"}}},"pull_request":{"url":"https://api.github.com/repos/plotly/plotly.py/pulls/359","id":51740087,"html_url":"https://github.com/plotly/plotly.py/pull/359","diff_url":"https://github.com/plotly/plotly.py/pull/359.diff","patch_url":"https://github.com/plotly/plotly.py/pull/359.patch","issue_url":"https://api.github.com/repos/plotly/plotly.py/issues/359","number":359,"state":"open","locked":false,"title":"Annotated heatmap","user":{"login":"cldougl","id":2789078,"avatar_url":"https://avatars.githubusercontent.com/u/2789078?v=3","gravatar_id":"","url":"https://api.github.com/users/cldougl","html_url":"https://github.com/cldougl","followers_url":"https://api.github.com/users/cldougl/followers","following_url":"https://api.github.com/users/cldougl/following{/other_user}","gists_url":"https://api.github.com/users/cldougl/gists{/gist_id}","starred_url":"https://api.github.com/users/cldougl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cldougl/subscriptions","organizations_url":"https://api.github.com/users/cldougl/orgs","repos_url":"https://api.github.com/users/cldougl/repos","events_url":"https://api.github.com/users/cldougl/events{/privacy}","received_events_url":"https://api.github.com/users/cldougl/received_events","type":"User","site_admin":false},"body":"- add annotated heatmaps and tables to FigureFactory","created_at":"2015-11-25T01:04:20Z","updated_at":"2015-11-26T01:01:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ccefb867cd0ac9e520af53e0de27419d253bc290","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/plotly/plotly.py/pulls/359/commits","review_comments_url":"https://api.github.com/repos/plotly/plotly.py/pulls/359/comments","review_comment_url":"https://api.github.com/repos/plotly/plotly.py/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plotly/plotly.py/issues/359/comments","statuses_url":"https://api.github.com/repos/plotly/plotly.py/statuses/27f8efa177b46cdbd3e7e91b2cd69584097a9f69","head":{"label":"plotly:annotated_heatmap","ref":"annotated_heatmap","sha":"27f8efa177b46cdbd3e7e91b2cd69584097a9f69","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":14579099,"name":"plotly.py","full_name":"plotly/plotly.py","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.py","description":"the browser-based graphing library for python","fork":false,"url":"https://api.github.com/repos/plotly/plotly.py","forks_url":"https://api.github.com/repos/plotly/plotly.py/forks","keys_url":"https://api.github.com/repos/plotly/plotly.py/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.py/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.py/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.py/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.py/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.py/events","assignees_url":"https://api.github.com/repos/plotly/plotly.py/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.py/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.py/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.py/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.py/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.py/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.py/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.py/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.py/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.py/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.py/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.py/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.py/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.py/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.py/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.py/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.py/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.py/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.py/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.py/merges","archive_url":"https://api.github.com/repos/plotly/plotly.py/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.py/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.py/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.py/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.py/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.py/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.py/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.py/releases{/id}","created_at":"2013-11-21T05:53:08Z","updated_at":"2015-11-25T15:26:02Z","pushed_at":"2015-11-25T22:39:07Z","git_url":"git://github.com/plotly/plotly.py.git","ssh_url":"git@github.com:plotly/plotly.py.git","clone_url":"https://github.com/plotly/plotly.py.git","svn_url":"https://github.com/plotly/plotly.py","homepage":"https://plot.ly/python/","size":7480,"stargazers_count":374,"watchers_count":374,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":93,"forks":85,"open_issues":93,"watchers":374,"default_branch":"master"}},"base":{"label":"plotly:master","ref":"master","sha":"06e0be5982531694eada8347ab38a1499c6965f6","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":14579099,"name":"plotly.py","full_name":"plotly/plotly.py","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.py","description":"the browser-based graphing library for python","fork":false,"url":"https://api.github.com/repos/plotly/plotly.py","forks_url":"https://api.github.com/repos/plotly/plotly.py/forks","keys_url":"https://api.github.com/repos/plotly/plotly.py/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.py/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.py/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.py/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.py/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.py/events","assignees_url":"https://api.github.com/repos/plotly/plotly.py/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.py/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.py/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.py/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.py/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.py/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.py/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.py/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.py/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.py/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.py/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.py/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.py/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.py/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.py/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.py/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.py/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.py/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.py/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.py/merges","archive_url":"https://api.github.com/repos/plotly/plotly.py/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.py/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.py/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.py/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.py/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.py/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.py/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.py/releases{/id}","created_at":"2013-11-21T05:53:08Z","updated_at":"2015-11-25T15:26:02Z","pushed_at":"2015-11-25T22:39:07Z","git_url":"git://github.com/plotly/plotly.py.git","ssh_url":"git@github.com:plotly/plotly.py.git","clone_url":"https://github.com/plotly/plotly.py.git","svn_url":"https://github.com/plotly/plotly.py","homepage":"https://plot.ly/python/","size":7480,"stargazers_count":374,"watchers_count":374,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":93,"forks":85,"open_issues":93,"watchers":374,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.py/pulls/359"},"html":{"href":"https://github.com/plotly/plotly.py/pull/359"},"issue":{"href":"https://api.github.com/repos/plotly/plotly.py/issues/359"},"comments":{"href":"https://api.github.com/repos/plotly/plotly.py/issues/359/comments"},"review_comments":{"href":"https://api.github.com/repos/plotly/plotly.py/pulls/359/comments"},"review_comment":{"href":"https://api.github.com/repos/plotly/plotly.py/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plotly/plotly.py/pulls/359/commits"},"statuses":{"href":"https://api.github.com/repos/plotly/plotly.py/statuses/27f8efa177b46cdbd3e7e91b2cd69584097a9f69"}}}}