{"action":"closed","number":6086,"pull_request":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/6086","id":61275932,"html_url":"https://github.com/matplotlib/matplotlib/pull/6086","diff_url":"https://github.com/matplotlib/matplotlib/pull/6086.diff","patch_url":"https://github.com/matplotlib/matplotlib/pull/6086.patch","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6086","number":6086,"state":"closed","locked":false,"title":"Offset and scaling factors in axis format  #4376","user":{"login":"VincentVandalon","id":10267494,"avatar_url":"https://avatars.githubusercontent.com/u/10267494?v=3","gravatar_id":"","url":"https://api.github.com/users/VincentVandalon","html_url":"https://github.com/VincentVandalon","followers_url":"https://api.github.com/users/VincentVandalon/followers","following_url":"https://api.github.com/users/VincentVandalon/following{/other_user}","gists_url":"https://api.github.com/users/VincentVandalon/gists{/gist_id}","starred_url":"https://api.github.com/users/VincentVandalon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VincentVandalon/subscriptions","organizations_url":"https://api.github.com/users/VincentVandalon/orgs","repos_url":"https://api.github.com/users/VincentVandalon/repos","events_url":"https://api.github.com/users/VincentVandalon/events{/privacy}","received_events_url":"https://api.github.com/users/VincentVandalon/received_events","type":"User","site_admin":false},"body":"Feature/Ticket   #4376 : Implemented functionality to let the user set an offset or\r\na scaling factor for a specific axis using ScalarFormatter.\r\n\r\n- Scaling and offset have become exclusive: either scaling or offset or nothing. This resolves ambiguity as (x-offset)/scalar != (x/scalar-offset)\r\n- Added a new method set_useScalingFactor(True|False|value)\r\n- Added a new method set_offset_string(string) that can override the automatic offset_string. This is useful when, for example, the used want to use a scalingFactor, but wants to display the scaling factor in the label: \"Atomic density (10^14 atoms/nm^2)\"\r\n- Wrote documentation for both set_useOffset(True|False|value) and set_useScalingFactor()\r\n- Updated existing documentation to match numpydoc format and updated documentation where I was sure of the purpose of the code\r\n- Fixed an (unreported) bug in HEAD that ignored the offset when scaling was performed automatically due to scientific notation (see discussion in ticket)\r\n- rcParams['axes.formatter.useoffset'] still controls whether to use offset when guessing best format.\r\n- set_powerlimits() still controls whether scaling is automatically performed\r\n\r\nPossible code to test the features:\r\n```python\r\n##########\r\n#Y-axis tests default\r\n#X-axis test user-set functions\r\n#left column = scaling, right column = offset\r\n#top row = (0...1)*1E10, bottom row = (0..1)+1E10\r\n##########\r\n\r\nimport numpy as np\r\nimport scipy as sp\r\nimport matplotlib.pyplot as plt\r\n\r\nscal=1E10\r\n\r\n##############1\r\nplt.subplot(221)\r\nx=sp.rand(100)*scal\r\ny=1000+x\r\nplt.scatter(x,y)\r\n\r\nplt.gca().get_xaxis().get_major_formatter().set_useScalingFactor(scal)\r\n\r\n\r\n##############2\r\nplt.subplot(222)\r\nx=sp.rand(100)*scal\r\ny=1000+x\r\nplt.scatter(x,y)\r\n\r\nplt.gca().get_xaxis().get_major_formatter().set_useOffset(scal)\r\n\r\n##############3\r\nplt.subplot(223)\r\nx=sp.rand(100)+scal\r\ny=1000+x\r\nplt.scatter(x,y,c='r')\r\n\r\nplt.gca().get_xaxis().get_major_formatter().set_useScalingFactor(scal)\r\n\r\n##############4\r\nplt.subplot(224)\r\nx=sp.rand(100)+scal\r\ny=1000+x\r\nplt.scatter(x,y,c='r')\r\n\r\nplt.gca().get_xaxis().get_major_formatter().set_useOffset(scal)\r\n#plt.gca().get_xaxis().get_major_formatter().set_offset_string('')\r\n\r\nplt.tight_layout()\r\nplt.savefig('test.pdf')\r\n\r\n```\r\n\r\n","created_at":"2016-03-01T17:14:51Z","updated_at":"2016-03-02T16:21:24Z","closed_at":"2016-03-02T16:21:23Z","merged_at":null,"merge_commit_sha":"1bdfc23eb12e8f34e950092e5f4d32229c3cdb29","assignee":null,"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/12","html_url":"https://github.com/matplotlib/matplotlib/milestones/2.1%20(next%20point%20release)","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/12/labels","id":534144,"number":12,"title":"2.1 (next point release)","description":"Next feature release.\r\n\r\nBig ticket items:\r\n\r\n - MEP 22/27\r\n - traitlets","creator":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"open_issues":461,"closed_issues":299,"state":"open","created_at":"2014-01-13T03:21:09Z","updated_at":"2016-03-02T16:21:23Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/6086/commits","review_comments_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/6086/comments","review_comment_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6086/comments","statuses_url":"https://api.github.com/repos/matplotlib/matplotlib/statuses/5368336d44490d935c803a38c87c1dee502e87e2","head":{"label":"VincentVandalon:offsetAxisFormat-4376","ref":"offsetAxisFormat-4376","sha":"5368336d44490d935c803a38c87c1dee502e87e2","user":{"login":"VincentVandalon","id":10267494,"avatar_url":"https://avatars.githubusercontent.com/u/10267494?v=3","gravatar_id":"","url":"https://api.github.com/users/VincentVandalon","html_url":"https://github.com/VincentVandalon","followers_url":"https://api.github.com/users/VincentVandalon/followers","following_url":"https://api.github.com/users/VincentVandalon/following{/other_user}","gists_url":"https://api.github.com/users/VincentVandalon/gists{/gist_id}","starred_url":"https://api.github.com/users/VincentVandalon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VincentVandalon/subscriptions","organizations_url":"https://api.github.com/users/VincentVandalon/orgs","repos_url":"https://api.github.com/users/VincentVandalon/repos","events_url":"https://api.github.com/users/VincentVandalon/events{/privacy}","received_events_url":"https://api.github.com/users/VincentVandalon/received_events","type":"User","site_admin":false},"repo":{"id":52147981,"name":"matplotlib","full_name":"VincentVandalon/matplotlib","owner":{"login":"VincentVandalon","id":10267494,"avatar_url":"https://avatars.githubusercontent.com/u/10267494?v=3","gravatar_id":"","url":"https://api.github.com/users/VincentVandalon","html_url":"https://github.com/VincentVandalon","followers_url":"https://api.github.com/users/VincentVandalon/followers","following_url":"https://api.github.com/users/VincentVandalon/following{/other_user}","gists_url":"https://api.github.com/users/VincentVandalon/gists{/gist_id}","starred_url":"https://api.github.com/users/VincentVandalon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VincentVandalon/subscriptions","organizations_url":"https://api.github.com/users/VincentVandalon/orgs","repos_url":"https://api.github.com/users/VincentVandalon/repos","events_url":"https://api.github.com/users/VincentVandalon/events{/privacy}","received_events_url":"https://api.github.com/users/VincentVandalon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VincentVandalon/matplotlib","description":"matplotlib: plotting with Python","fork":true,"url":"https://api.github.com/repos/VincentVandalon/matplotlib","forks_url":"https://api.github.com/repos/VincentVandalon/matplotlib/forks","keys_url":"https://api.github.com/repos/VincentVandalon/matplotlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VincentVandalon/matplotlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VincentVandalon/matplotlib/teams","hooks_url":"https://api.github.com/repos/VincentVandalon/matplotlib/hooks","issue_events_url":"https://api.github.com/repos/VincentVandalon/matplotlib/issues/events{/number}","events_url":"https://api.github.com/repos/VincentVandalon/matplotlib/events","assignees_url":"https://api.github.com/repos/VincentVandalon/matplotlib/assignees{/user}","branches_url":"https://api.github.com/repos/VincentVandalon/matplotlib/branches{/branch}","tags_url":"https://api.github.com/repos/VincentVandalon/matplotlib/tags","blobs_url":"https://api.github.com/repos/VincentVandalon/matplotlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VincentVandalon/matplotlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VincentVandalon/matplotlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/VincentVandalon/matplotlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VincentVandalon/matplotlib/statuses/{sha}","languages_url":"https://api.github.com/repos/VincentVandalon/matplotlib/languages","stargazers_url":"https://api.github.com/repos/VincentVandalon/matplotlib/stargazers","contributors_url":"https://api.github.com/repos/VincentVandalon/matplotlib/contributors","subscribers_url":"https://api.github.com/repos/VincentVandalon/matplotlib/subscribers","subscription_url":"https://api.github.com/repos/VincentVandalon/matplotlib/subscription","commits_url":"https://api.github.com/repos/VincentVandalon/matplotlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/VincentVandalon/matplotlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/VincentVandalon/matplotlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/VincentVandalon/matplotlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/VincentVandalon/matplotlib/contents/{+path}","compare_url":"https://api.github.com/repos/VincentVandalon/matplotlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VincentVandalon/matplotlib/merges","archive_url":"https://api.github.com/repos/VincentVandalon/matplotlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VincentVandalon/matplotlib/downloads","issues_url":"https://api.github.com/repos/VincentVandalon/matplotlib/issues{/number}","pulls_url":"https://api.github.com/repos/VincentVandalon/matplotlib/pulls{/number}","milestones_url":"https://api.github.com/repos/VincentVandalon/matplotlib/milestones{/number}","notifications_url":"https://api.github.com/repos/VincentVandalon/matplotlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VincentVandalon/matplotlib/labels{/name}","releases_url":"https://api.github.com/repos/VincentVandalon/matplotlib/releases{/id}","deployments_url":"https://api.github.com/repos/VincentVandalon/matplotlib/deployments","created_at":"2016-02-20T10:23:48Z","updated_at":"2016-02-20T10:23:57Z","pushed_at":"2016-03-02T14:52:36Z","git_url":"git://github.com/VincentVandalon/matplotlib.git","ssh_url":"git@github.com:VincentVandalon/matplotlib.git","clone_url":"https://github.com/VincentVandalon/matplotlib.git","svn_url":"https://github.com/VincentVandalon/matplotlib","homepage":"http://matplotlib.org/","size":275838,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"matplotlib:master","ref":"master","sha":"3ba9279fd9810b088d876988b8b7cf419e470716","user":{"login":"matplotlib","id":215947,"avatar_url":"https://avatars.githubusercontent.com/u/215947?v=3","gravatar_id":"","url":"https://api.github.com/users/matplotlib","html_url":"https://github.com/matplotlib","followers_url":"https://api.github.com/users/matplotlib/followers","following_url":"https://api.github.com/users/matplotlib/following{/other_user}","gists_url":"https://api.github.com/users/matplotlib/gists{/gist_id}","starred_url":"https://api.github.com/users/matplotlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matplotlib/subscriptions","organizations_url":"https://api.github.com/users/matplotlib/orgs","repos_url":"https://api.github.com/users/matplotlib/repos","events_url":"https://api.github.com/users/matplotlib/events{/privacy}","received_events_url":"https://api.github.com/users/matplotlib/received_events","type":"Organization","site_admin":false},"repo":{"id":1385122,"name":"matplotlib","full_name":"matplotlib/matplotlib","owner":{"login":"matplotlib","id":215947,"avatar_url":"https://avatars.githubusercontent.com/u/215947?v=3","gravatar_id":"","url":"https://api.github.com/users/matplotlib","html_url":"https://github.com/matplotlib","followers_url":"https://api.github.com/users/matplotlib/followers","following_url":"https://api.github.com/users/matplotlib/following{/other_user}","gists_url":"https://api.github.com/users/matplotlib/gists{/gist_id}","starred_url":"https://api.github.com/users/matplotlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matplotlib/subscriptions","organizations_url":"https://api.github.com/users/matplotlib/orgs","repos_url":"https://api.github.com/users/matplotlib/repos","events_url":"https://api.github.com/users/matplotlib/events{/privacy}","received_events_url":"https://api.github.com/users/matplotlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matplotlib/matplotlib","description":"matplotlib: plotting with Python","fork":false,"url":"https://api.github.com/repos/matplotlib/matplotlib","forks_url":"https://api.github.com/repos/matplotlib/matplotlib/forks","keys_url":"https://api.github.com/repos/matplotlib/matplotlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matplotlib/matplotlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matplotlib/matplotlib/teams","hooks_url":"https://api.github.com/repos/matplotlib/matplotlib/hooks","issue_events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/events{/number}","events_url":"https://api.github.com/repos/matplotlib/matplotlib/events","assignees_url":"https://api.github.com/repos/matplotlib/matplotlib/assignees{/user}","branches_url":"https://api.github.com/repos/matplotlib/matplotlib/branches{/branch}","tags_url":"https://api.github.com/repos/matplotlib/matplotlib/tags","blobs_url":"https://api.github.com/repos/matplotlib/matplotlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matplotlib/matplotlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matplotlib/matplotlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/matplotlib/matplotlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matplotlib/matplotlib/statuses/{sha}","languages_url":"https://api.github.com/repos/matplotlib/matplotlib/languages","stargazers_url":"https://api.github.com/repos/matplotlib/matplotlib/stargazers","contributors_url":"https://api.github.com/repos/matplotlib/matplotlib/contributors","subscribers_url":"https://api.github.com/repos/matplotlib/matplotlib/subscribers","subscription_url":"https://api.github.com/repos/matplotlib/matplotlib/subscription","commits_url":"https://api.github.com/repos/matplotlib/matplotlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/matplotlib/matplotlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/matplotlib/matplotlib/contents/{+path}","compare_url":"https://api.github.com/repos/matplotlib/matplotlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matplotlib/matplotlib/merges","archive_url":"https://api.github.com/repos/matplotlib/matplotlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matplotlib/matplotlib/downloads","issues_url":"https://api.github.com/repos/matplotlib/matplotlib/issues{/number}","pulls_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls{/number}","milestones_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones{/number}","notifications_url":"https://api.github.com/repos/matplotlib/matplotlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/labels{/name}","releases_url":"https://api.github.com/repos/matplotlib/matplotlib/releases{/id}","deployments_url":"https://api.github.com/repos/matplotlib/matplotlib/deployments","created_at":"2011-02-19T03:17:12Z","updated_at":"2016-03-02T12:40:04Z","pushed_at":"2016-03-02T16:01:33Z","git_url":"git://github.com/matplotlib/matplotlib.git","ssh_url":"git@github.com:matplotlib/matplotlib.git","clone_url":"https://github.com/matplotlib/matplotlib.git","svn_url":"https://github.com/matplotlib/matplotlib","homepage":"http://matplotlib.org/","size":385642,"stargazers_count":3352,"watchers_count":3352,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1710,"mirror_url":null,"open_issues_count":859,"forks":1710,"open_issues":859,"watchers":3352,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/6086"},"html":{"href":"https://github.com/matplotlib/matplotlib/pull/6086"},"issue":{"href":"https://api.github.com/repos/matplotlib/matplotlib/issues/6086"},"comments":{"href":"https://api.github.com/repos/matplotlib/matplotlib/issues/6086/comments"},"review_comments":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/6086/comments"},"review_comment":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/6086/commits"},"statuses":{"href":"https://api.github.com/repos/matplotlib/matplotlib/statuses/5368336d44490d935c803a38c87c1dee502e87e2"}},"merged":false,"mergeable":true,"mergeable_state":"unstable","merged_by":null,"comments":1,"review_comments":0,"commits":7,"additions":202,"deletions":76,"changed_files":1}}