{"action":"opened","issue":{"url":"https://api.github.com/repos/juba/scatterD3/issues/49","repository_url":"https://api.github.com/repos/juba/scatterD3","labels_url":"https://api.github.com/repos/juba/scatterD3/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/juba/scatterD3/issues/49/comments","events_url":"https://api.github.com/repos/juba/scatterD3/issues/49/events","html_url":"https://github.com/juba/scatterD3/issues/49","id":191588483,"number":49,"title":"Keep centred focus for fixed axes","user":{"login":"jon-nagra","id":23722004,"avatar_url":"https://avatars.githubusercontent.com/u/23722004?v=3","gravatar_id":"","url":"https://api.github.com/users/jon-nagra","html_url":"https://github.com/jon-nagra","followers_url":"https://api.github.com/users/jon-nagra/followers","following_url":"https://api.github.com/users/jon-nagra/following{/other_user}","gists_url":"https://api.github.com/users/jon-nagra/gists{/gist_id}","starred_url":"https://api.github.com/users/jon-nagra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jon-nagra/subscriptions","organizations_url":"https://api.github.com/users/jon-nagra/orgs","repos_url":"https://api.github.com/users/jon-nagra/repos","events_url":"https://api.github.com/users/jon-nagra/events{/privacy}","received_events_url":"https://api.github.com/users/jon-nagra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-24T20:37:34Z","updated_at":"2016-11-24T20:37:34Z","closed_at":null,"body":"The plots with fixed axes not centred on the origin are displayed in the upper left corner.\r\nIf the variables xlim and ylim are fixed correctly this issue can be overridden, but, it requires a manual fix.\r\nA piece of r code that illustrates the issue and the manual solution:\r\n\r\n\r\n```\r\nlibrary(scatterD3)\r\nxvar=cos(seq(0,2*pi,length.out=200))\r\nyvar=2*sin(seq(0,2*pi,length.out=200))\r\n\r\n\r\nscatterD3(x=xvar,y=yvar,fixed=TRUE)\r\n\r\nmove<-c(1,3)\r\nxvar=xvar+move[1]\r\nyvar=yvar+move[2]\r\n# The ellipse is not centred\r\nscatterD3(x=xvar,y=yvar,fixed=TRUE)\r\n\r\n\r\n# fixing the issue manually \r\n\r\n# margin included so the points are not just at the border\r\nmargin=0.02\r\n\r\n# calculate xlim and ylim\r\nxmin=min(xvar)\r\nxmax=max(xvar)\r\nxd=xmax-xmin\r\nxmin=xmin-xd*margin\r\nxmax=xmax-xd*margin\r\n\r\nymin=min(yvar)\r\nymax=max(yvar)\r\nyd=ymax-ymin\r\nymin=ymin-yd*margin\r\nymax=ymax+yd*margin\r\n\r\nif(xd>yd){\r\n    ymin=ymin-(xd-yd)/2\r\n    ymax=ymax+(xd-yd)/2\r\n}else{\r\n    xmin=xmin-(yd-xd)/2\r\n    xmax=xmax+(yd-xd)/2\r\n}\r\n\r\nscatterD3(x=xvar,y=yvar,\r\n          xlim=c(xmin,xmax),\r\n          ylim=c(ymin,ymax),\r\n          fixed=TRUE)\r\n  \r\n```\r\n"}}
{"actor":{"display_login":"jon-nagra"}}