{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4970","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4970/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4970/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4970/events","html_url":"https://github.com/matplotlib/matplotlib/pull/4970","id":102064002,"number":4970,"title":"Fixed ZoomPanBase to work with log plots","user":{"login":"ordirules","id":705366,"avatar_url":"https://avatars.githubusercontent.com/u/705366?v=3","gravatar_id":"","url":"https://api.github.com/users/ordirules","html_url":"https://github.com/ordirules","followers_url":"https://api.github.com/users/ordirules/followers","following_url":"https://api.github.com/users/ordirules/following{/other_user}","gists_url":"https://api.github.com/users/ordirules/gists{/gist_id}","starred_url":"https://api.github.com/users/ordirules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ordirules/subscriptions","organizations_url":"https://api.github.com/users/ordirules/orgs","repos_url":"https://api.github.com/users/ordirules/repos","events_url":"https://api.github.com/users/ordirules/events{/privacy}","received_events_url":"https://api.github.com/users/ordirules/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/matplotlib/matplotlib/labels/needs_revision","name":"needs_revision","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"fariza","id":1490153,"avatar_url":"https://avatars.githubusercontent.com/u/1490153?v=3","gravatar_id":"","url":"https://api.github.com/users/fariza","html_url":"https://github.com/fariza","followers_url":"https://api.github.com/users/fariza/followers","following_url":"https://api.github.com/users/fariza/following{/other_user}","gists_url":"https://api.github.com/users/fariza/gists{/gist_id}","starred_url":"https://api.github.com/users/fariza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fariza/subscriptions","organizations_url":"https://api.github.com/users/fariza/orgs","repos_url":"https://api.github.com/users/fariza/repos","events_url":"https://api.github.com/users/fariza/events{/privacy}","received_events_url":"https://api.github.com/users/fariza/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/12","html_url":"https://github.com/matplotlib/matplotlib/milestones/proposed%20next%20point%20release","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/12/labels","id":534144,"number":12,"title":"proposed next point release","description":"","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":390,"closed_issues":231,"state":"open","created_at":"2014-01-13T03:21:09Z","updated_at":"2015-08-24T20:13:04Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2015-08-20T05:12:15Z","updated_at":"2015-08-25T18:33:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4970","html_url":"https://github.com/matplotlib/matplotlib/pull/4970","diff_url":"https://github.com/matplotlib/matplotlib/pull/4970.diff","patch_url":"https://github.com/matplotlib/matplotlib/pull/4970.patch"},"body":"Tested this code in a matplotlib 1.4.3 environment and current branch. Fixed ZoomPanBase to work in non-linear plots by changing the scale in the axes coordinates and using the respective tranformation functions: transScale and transLimits transforms. \r\n\r\nSee tutorial on axes transformations for more details:\r\nhttp://matplotlib.org/users/transforms_tutorial.html\r\n\r\nNote: It did not work in my version 1.4.2. The issue is traceable to the TransScale.transform.inverted() routine expecting a 2 dimensional array rather than 1d array. If applying this to this older version this should be investigated/tested.\r\n\r\nTesting code used (use mouse scroll wheel afterwards):\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.backend_tools as bt\r\nimport numpy as np\r\n\r\nfig1 = plt.figure(0)\r\nzm = bt.ZoomPanBase(fig1,\"foo\")\r\n\r\n\r\nimg = np.random.random((100,100))\r\nax = fig1.add_subplot(111)\r\n\r\nx = np.linspace(10,1000,1000)\r\ny = 1/x**4\r\n\r\n#uncomment the one you want to test, and comment the other\r\n#ax.imshow(img)\r\nax.loglog(x,y)\r\n\r\ndef foofunc():\r\n    pass\r\n\r\nzm._press = foofunc\r\nzm._release = foofunc\r\n\r\nzm.enable(\"foo\")\r\n```"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/134695465","html_url":"https://github.com/matplotlib/matplotlib/pull/4970#issuecomment-134695465","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4970","id":134695465,"user":{"login":"ordirules","id":705366,"avatar_url":"https://avatars.githubusercontent.com/u/705366?v=3","gravatar_id":"","url":"https://api.github.com/users/ordirules","html_url":"https://github.com/ordirules","followers_url":"https://api.github.com/users/ordirules/followers","following_url":"https://api.github.com/users/ordirules/following{/other_user}","gists_url":"https://api.github.com/users/ordirules/gists{/gist_id}","starred_url":"https://api.github.com/users/ordirules/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ordirules/subscriptions","organizations_url":"https://api.github.com/users/ordirules/orgs","repos_url":"https://api.github.com/users/ordirules/repos","events_url":"https://api.github.com/users/ordirules/events{/privacy}","received_events_url":"https://api.github.com/users/ordirules/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T18:33:56Z","updated_at":"2015-08-25T18:33:56Z","body":"That makes a lot of sense, very good point. Didn't notice that the others inherit from ZoomPanBase. ToolZoom looks redundant with transScale (probably preceded it ;-) ) so it would make sense to clean up the duplicate code and follow the current [transformations philosophy] (http://matplotlib.org/users/transforms_tutorial.html), from my understanding of the tutorial.\r\n\r\nThe function could be something like \"expandshift(ax,x0,y0,x1,y0)\" where x,y are the limits in axes coordinates of the new viewbox. I prefer this over \"changeview\" or something because it emphasizes the relative nature (and potential dangers of looping through).\r\n\r\nI think it would also make sense to go deeper and have it part of _AxesBase. The main motivation for this is that it would make life easier for a developer who would want to write their own custom routine without using the GUI. From what I understand (correct me if I'm wrong), but all these inherit from ToolBase which is inherently a GUI feature.\r\n\r\nAnyway, what do you think? To sort of summarize:\r\n1. Does such a method already exist to change Axes in _AxesBase?\r\n2. Do you think it's a good idea to add this feature to axes base?\r\n\r\nI'll do some reading tonight which may answer my first question (currently busy), but I figured I would ask. Anyway, this is a very good point and I vote for your idea (either case, if it goes in Axes or ZoomPanBase)."}}