{"action":"created","comment":{"url":"https://api.github.com/repos/has2k1/plotnine/pulls/comments/227122348","pull_request_review_id":167083953,"id":227122348,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzEyMjM0OA==","diff_hunk":"@@ -77,11 +78,22 @@ def __init__(self, geom, x=None, y=None,\n                 break\n \n         data = pd.DataFrame(position)\n-        geom = Registry['geom_{}'.format(geom)]\n+        try:\n+            if isinstance(geom_cls_or_name, str):\n+                geom_to_use = Registry['geom_{}'.format(geom_cls_or_name)]\n+            elif isinstance(geom_cls_or_name, type) and issubclass(geom_cls_or_name, geom.geom):\n+                geom_to_use = geom_cls_or_name\n+            else:\n+                raise PlotnineError() # error message comes below\n+        except PlotnineError:\n+            raise PlotnineError(\"geom_cls_or_name must either be a geom.geom() \" +\n+                             \"descendant (e.g. plotnine.geom_point), or \" +\n+                             \"a string naming a geom (e.g. 'point', 'text', \" +\n+                             \"...). Was {}\".format(repr(geom_cls_or_name)))","path":"plotnine/geoms/annotate.py","position":44,"original_position":44,"commit_id":"e029141f0d0f92b69780f634ffdeb95e3feeeecd","original_commit_id":"e029141f0d0f92b69780f634ffdeb95e3feeeecd","user":{"login":"has2k1","id":780341,"node_id":"MDQ6VXNlcjc4MDM0MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/780341?v=4","gravatar_id":"","url":"https://api.github.com/users/has2k1","html_url":"https://github.com/has2k1","followers_url":"https://api.github.com/users/has2k1/followers","following_url":"https://api.github.com/users/has2k1/following{/other_user}","gists_url":"https://api.github.com/users/has2k1/gists{/gist_id}","starred_url":"https://api.github.com/users/has2k1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/has2k1/subscriptions","organizations_url":"https://api.github.com/users/has2k1/orgs","repos_url":"https://api.github.com/users/has2k1/repos","events_url":"https://api.github.com/users/has2k1/events{/privacy}","received_events_url":"https://api.github.com/users/has2k1/received_events","type":"User","site_admin":false},"body":"No need for the `+`. And I think the link checker will scream about the indentation.","created_at":"2018-10-22T20:16:31Z","updated_at":"2018-10-22T20:20:16Z","html_url":"https://github.com/has2k1/plotnine/pull/213#discussion_r227122348","pull_request_url":"https://api.github.com/repos/has2k1/plotnine/pulls/213","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/has2k1/plotnine/pulls/comments/227122348"},"html":{"href":"https://github.com/has2k1/plotnine/pull/213#discussion_r227122348"},"pull_request":{"href":"https://api.github.com/repos/has2k1/plotnine/pulls/213"}}},"pull_request":{"url":"https://api.github.com/repos/has2k1/plotnine/pulls/213","id":224613654,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NjEzNjU0","html_url":"https://github.com/has2k1/plotnine/pull/213","diff_url":"https://github.com/has2k1/plotnine/pull/213.diff","patch_url":"https://github.com/has2k1/plotnine/pull/213.patch","issue_url":"https://api.github.com/repos/has2k1/plotnine/issues/213","number":213,"state":"open","locked":false,"title":"annotate accepts name or geom-descendant class as first parameter","user":{"login":"TyberiusPrime","id":1257580,"node_id":"MDQ6VXNlcjEyNTc1ODA=","avatar_url":"https://avatars2.githubusercontent.com/u/1257580?v=4","gravatar_id":"","url":"https://api.github.com/users/TyberiusPrime","html_url":"https://github.com/TyberiusPrime","followers_url":"https://api.github.com/users/TyberiusPrime/followers","following_url":"https://api.github.com/users/TyberiusPrime/following{/other_user}","gists_url":"https://api.github.com/users/TyberiusPrime/gists{/gist_id}","starred_url":"https://api.github.com/users/TyberiusPrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TyberiusPrime/subscriptions","organizations_url":"https://api.github.com/users/TyberiusPrime/orgs","repos_url":"https://api.github.com/users/TyberiusPrime/repos","events_url":"https://api.github.com/users/TyberiusPrime/events{/privacy}","received_events_url":"https://api.github.com/users/TyberiusPrime/received_events","type":"User","site_admin":false},"body":"Improve annotate() to accept either a geom_* class (descendant of geom()) or the\r\nprevious string-based geom definition (as in ggplot2).\r\n\r\nIncludes test cases and improved exception.","created_at":"2018-10-22T08:13:20Z","updated_at":"2018-10-22T20:20:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"177161191e28cce2130741491169e7c543df012b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/has2k1/plotnine/pulls/213/commits","review_comments_url":"https://api.github.com/repos/has2k1/plotnine/pulls/213/comments","review_comment_url":"https://api.github.com/repos/has2k1/plotnine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/has2k1/plotnine/issues/213/comments","statuses_url":"https://api.github.com/repos/has2k1/plotnine/statuses/e029141f0d0f92b69780f634ffdeb95e3feeeecd","head":{"label":"TyberiusPrime:annotate_accepts_geom","ref":"annotate_accepts_geom","sha":"e029141f0d0f92b69780f634ffdeb95e3feeeecd","user":{"login":"TyberiusPrime","id":1257580,"node_id":"MDQ6VXNlcjEyNTc1ODA=","avatar_url":"https://avatars2.githubusercontent.com/u/1257580?v=4","gravatar_id":"","url":"https://api.github.com/users/TyberiusPrime","html_url":"https://github.com/TyberiusPrime","followers_url":"https://api.github.com/users/TyberiusPrime/followers","following_url":"https://api.github.com/users/TyberiusPrime/following{/other_user}","gists_url":"https://api.github.com/users/TyberiusPrime/gists{/gist_id}","starred_url":"https://api.github.com/users/TyberiusPrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TyberiusPrime/subscriptions","organizations_url":"https://api.github.com/users/TyberiusPrime/orgs","repos_url":"https://api.github.com/users/TyberiusPrime/repos","events_url":"https://api.github.com/users/TyberiusPrime/events{/privacy}","received_events_url":"https://api.github.com/users/TyberiusPrime/received_events","type":"User","site_admin":false},"repo":{"id":150585509,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA1ODU1MDk=","name":"plotnine","full_name":"TyberiusPrime/plotnine","private":false,"owner":{"login":"TyberiusPrime","id":1257580,"node_id":"MDQ6VXNlcjEyNTc1ODA=","avatar_url":"https://avatars2.githubusercontent.com/u/1257580?v=4","gravatar_id":"","url":"https://api.github.com/users/TyberiusPrime","html_url":"https://github.com/TyberiusPrime","followers_url":"https://api.github.com/users/TyberiusPrime/followers","following_url":"https://api.github.com/users/TyberiusPrime/following{/other_user}","gists_url":"https://api.github.com/users/TyberiusPrime/gists{/gist_id}","starred_url":"https://api.github.com/users/TyberiusPrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TyberiusPrime/subscriptions","organizations_url":"https://api.github.com/users/TyberiusPrime/orgs","repos_url":"https://api.github.com/users/TyberiusPrime/repos","events_url":"https://api.github.com/users/TyberiusPrime/events{/privacy}","received_events_url":"https://api.github.com/users/TyberiusPrime/received_events","type":"User","site_admin":false},"html_url":"https://github.com/TyberiusPrime/plotnine","description":"A grammar of graphics for Python","fork":true,"url":"https://api.github.com/repos/TyberiusPrime/plotnine","forks_url":"https://api.github.com/repos/TyberiusPrime/plotnine/forks","keys_url":"https://api.github.com/repos/TyberiusPrime/plotnine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TyberiusPrime/plotnine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TyberiusPrime/plotnine/teams","hooks_url":"https://api.github.com/repos/TyberiusPrime/plotnine/hooks","issue_events_url":"https://api.github.com/repos/TyberiusPrime/plotnine/issues/events{/number}","events_url":"https://api.github.com/repos/TyberiusPrime/plotnine/events","assignees_url":"https://api.github.com/repos/TyberiusPrime/plotnine/assignees{/user}","branches_url":"https://api.github.com/repos/TyberiusPrime/plotnine/branches{/branch}","tags_url":"https://api.github.com/repos/TyberiusPrime/plotnine/tags","blobs_url":"https://api.github.com/repos/TyberiusPrime/plotnine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TyberiusPrime/plotnine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TyberiusPrime/plotnine/git/refs{/sha}","trees_url":"https://api.github.com/repos/TyberiusPrime/plotnine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TyberiusPrime/plotnine/statuses/{sha}","languages_url":"https://api.github.com/repos/TyberiusPrime/plotnine/languages","stargazers_url":"https://api.github.com/repos/TyberiusPrime/plotnine/stargazers","contributors_url":"https://api.github.com/repos/TyberiusPrime/plotnine/contributors","subscribers_url":"https://api.github.com/repos/TyberiusPrime/plotnine/subscribers","subscription_url":"https://api.github.com/repos/TyberiusPrime/plotnine/subscription","commits_url":"https://api.github.com/repos/TyberiusPrime/plotnine/commits{/sha}","git_commits_url":"https://api.github.com/repos/TyberiusPrime/plotnine/git/commits{/sha}","comments_url":"https://api.github.com/repos/TyberiusPrime/plotnine/comments{/number}","issue_comment_url":"https://api.github.com/repos/TyberiusPrime/plotnine/issues/comments{/number}","contents_url":"https://api.github.com/repos/TyberiusPrime/plotnine/contents/{+path}","compare_url":"https://api.github.com/repos/TyberiusPrime/plotnine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TyberiusPrime/plotnine/merges","archive_url":"https://api.github.com/repos/TyberiusPrime/plotnine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TyberiusPrime/plotnine/downloads","issues_url":"https://api.github.com/repos/TyberiusPrime/plotnine/issues{/number}","pulls_url":"https://api.github.com/repos/TyberiusPrime/plotnine/pulls{/number}","milestones_url":"https://api.github.com/repos/TyberiusPrime/plotnine/milestones{/number}","notifications_url":"https://api.github.com/repos/TyberiusPrime/plotnine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TyberiusPrime/plotnine/labels{/name}","releases_url":"https://api.github.com/repos/TyberiusPrime/plotnine/releases{/id}","deployments_url":"https://api.github.com/repos/TyberiusPrime/plotnine/deployments","created_at":"2018-09-27T12:45:34Z","updated_at":"2018-10-22T13:30:19Z","pushed_at":"2018-10-22T13:30:18Z","git_url":"git://github.com/TyberiusPrime/plotnine.git","ssh_url":"git@github.com:TyberiusPrime/plotnine.git","clone_url":"https://github.com/TyberiusPrime/plotnine.git","svn_url":"https://github.com/TyberiusPrime/plotnine","homepage":"https://plotnine.readthedocs.io/en/stable/","size":6992,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"has2k1:master","ref":"master","sha":"077c1cd6e1d192660b2675bd7395e2e6e505b45f","user":{"login":"has2k1","id":780341,"node_id":"MDQ6VXNlcjc4MDM0MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/780341?v=4","gravatar_id":"","url":"https://api.github.com/users/has2k1","html_url":"https://github.com/has2k1","followers_url":"https://api.github.com/users/has2k1/followers","following_url":"https://api.github.com/users/has2k1/following{/other_user}","gists_url":"https://api.github.com/users/has2k1/gists{/gist_id}","starred_url":"https://api.github.com/users/has2k1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/has2k1/subscriptions","organizations_url":"https://api.github.com/users/has2k1/orgs","repos_url":"https://api.github.com/users/has2k1/repos","events_url":"https://api.github.com/users/has2k1/events{/privacy}","received_events_url":"https://api.github.com/users/has2k1/received_events","type":"User","site_admin":false},"repo":{"id":89276692,"node_id":"MDEwOlJlcG9zaXRvcnk4OTI3NjY5Mg==","name":"plotnine","full_name":"has2k1/plotnine","private":false,"owner":{"login":"has2k1","id":780341,"node_id":"MDQ6VXNlcjc4MDM0MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/780341?v=4","gravatar_id":"","url":"https://api.github.com/users/has2k1","html_url":"https://github.com/has2k1","followers_url":"https://api.github.com/users/has2k1/followers","following_url":"https://api.github.com/users/has2k1/following{/other_user}","gists_url":"https://api.github.com/users/has2k1/gists{/gist_id}","starred_url":"https://api.github.com/users/has2k1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/has2k1/subscriptions","organizations_url":"https://api.github.com/users/has2k1/orgs","repos_url":"https://api.github.com/users/has2k1/repos","events_url":"https://api.github.com/users/has2k1/events{/privacy}","received_events_url":"https://api.github.com/users/has2k1/received_events","type":"User","site_admin":false},"html_url":"https://github.com/has2k1/plotnine","description":"A grammar of graphics for Python","fork":false,"url":"https://api.github.com/repos/has2k1/plotnine","forks_url":"https://api.github.com/repos/has2k1/plotnine/forks","keys_url":"https://api.github.com/repos/has2k1/plotnine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/has2k1/plotnine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/has2k1/plotnine/teams","hooks_url":"https://api.github.com/repos/has2k1/plotnine/hooks","issue_events_url":"https://api.github.com/repos/has2k1/plotnine/issues/events{/number}","events_url":"https://api.github.com/repos/has2k1/plotnine/events","assignees_url":"https://api.github.com/repos/has2k1/plotnine/assignees{/user}","branches_url":"https://api.github.com/repos/has2k1/plotnine/branches{/branch}","tags_url":"https://api.github.com/repos/has2k1/plotnine/tags","blobs_url":"https://api.github.com/repos/has2k1/plotnine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/has2k1/plotnine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/has2k1/plotnine/git/refs{/sha}","trees_url":"https://api.github.com/repos/has2k1/plotnine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/has2k1/plotnine/statuses/{sha}","languages_url":"https://api.github.com/repos/has2k1/plotnine/languages","stargazers_url":"https://api.github.com/repos/has2k1/plotnine/stargazers","contributors_url":"https://api.github.com/repos/has2k1/plotnine/contributors","subscribers_url":"https://api.github.com/repos/has2k1/plotnine/subscribers","subscription_url":"https://api.github.com/repos/has2k1/plotnine/subscription","commits_url":"https://api.github.com/repos/has2k1/plotnine/commits{/sha}","git_commits_url":"https://api.github.com/repos/has2k1/plotnine/git/commits{/sha}","comments_url":"https://api.github.com/repos/has2k1/plotnine/comments{/number}","issue_comment_url":"https://api.github.com/repos/has2k1/plotnine/issues/comments{/number}","contents_url":"https://api.github.com/repos/has2k1/plotnine/contents/{+path}","compare_url":"https://api.github.com/repos/has2k1/plotnine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/has2k1/plotnine/merges","archive_url":"https://api.github.com/repos/has2k1/plotnine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/has2k1/plotnine/downloads","issues_url":"https://api.github.com/repos/has2k1/plotnine/issues{/number}","pulls_url":"https://api.github.com/repos/has2k1/plotnine/pulls{/number}","milestones_url":"https://api.github.com/repos/has2k1/plotnine/milestones{/number}","notifications_url":"https://api.github.com/repos/has2k1/plotnine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/has2k1/plotnine/labels{/name}","releases_url":"https://api.github.com/repos/has2k1/plotnine/releases{/id}","deployments_url":"https://api.github.com/repos/has2k1/plotnine/deployments","created_at":"2017-04-24T19:00:44Z","updated_at":"2018-10-22T11:18:40Z","pushed_at":"2018-10-22T13:30:19Z","git_url":"git://github.com/has2k1/plotnine.git","ssh_url":"git@github.com:has2k1/plotnine.git","clone_url":"https://github.com/has2k1/plotnine.git","svn_url":"https://github.com/has2k1/plotnine","homepage":"https://plotnine.readthedocs.io/en/stable/","size":6781,"stargazers_count":1301,"watchers_count":1301,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":64,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":64,"open_issues":29,"watchers":1301,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/has2k1/plotnine/pulls/213"},"html":{"href":"https://github.com/has2k1/plotnine/pull/213"},"issue":{"href":"https://api.github.com/repos/has2k1/plotnine/issues/213"},"comments":{"href":"https://api.github.com/repos/has2k1/plotnine/issues/213/comments"},"review_comments":{"href":"https://api.github.com/repos/has2k1/plotnine/pulls/213/comments"},"review_comment":{"href":"https://api.github.com/repos/has2k1/plotnine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/has2k1/plotnine/pulls/213/commits"},"statuses":{"href":"https://api.github.com/repos/has2k1/plotnine/statuses/e029141f0d0f92b69780f634ffdeb95e3feeeecd"}},"author_association":"NONE"}}
{"actor":{"display_login":"has2k1"}}