{"action":"created","issue":{"url":"https://api.github.com/repos/mtennekes/tmap/issues/54","repository_url":"https://api.github.com/repos/mtennekes/tmap","labels_url":"https://api.github.com/repos/mtennekes/tmap/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/mtennekes/tmap/issues/54/comments","events_url":"https://api.github.com/repos/mtennekes/tmap/issues/54/events","html_url":"https://github.com/mtennekes/tmap/issues/54","id":145674957,"number":54,"title":"Anchorpoints for positioning legend and  tm_text labels","user":{"login":"sjewo","id":2435621,"avatar_url":"https://avatars.githubusercontent.com/u/2435621?v=3","gravatar_id":"","url":"https://api.github.com/users/sjewo","html_url":"https://github.com/sjewo","followers_url":"https://api.github.com/users/sjewo/followers","following_url":"https://api.github.com/users/sjewo/following{/other_user}","gists_url":"https://api.github.com/users/sjewo/gists{/gist_id}","starred_url":"https://api.github.com/users/sjewo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjewo/subscriptions","organizations_url":"https://api.github.com/users/sjewo/orgs","repos_url":"https://api.github.com/users/sjewo/repos","events_url":"https://api.github.com/users/sjewo/events{/privacy}","received_events_url":"https://api.github.com/users/sjewo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sjewo","id":2435621,"avatar_url":"https://avatars.githubusercontent.com/u/2435621?v=3","gravatar_id":"","url":"https://api.github.com/users/sjewo","html_url":"https://github.com/sjewo","followers_url":"https://api.github.com/users/sjewo/followers","following_url":"https://api.github.com/users/sjewo/following{/other_user}","gists_url":"https://api.github.com/users/sjewo/gists{/gist_id}","starred_url":"https://api.github.com/users/sjewo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjewo/subscriptions","organizations_url":"https://api.github.com/users/sjewo/orgs","repos_url":"https://api.github.com/users/sjewo/repos","events_url":"https://api.github.com/users/sjewo/events{/privacy}","received_events_url":"https://api.github.com/users/sjewo/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2016-04-04T12:48:43Z","updated_at":"2016-04-15T19:04:51Z","closed_at":null,"body":"Hi Martijn,\r\nI produced a lot of figures with your package and it's working really well!\r\nIf I look back at my workflow, it would be a great enhancement, if the positioning achor points (\"top left corner\", \"center\" and so on) could be explicitly defined.\r\n\r\nIn my usecase this had been useful in an specific situation:\r\nI produced multiple maps for the same shapefile with different variables. The automatic legend placement wasn't optimal, so I had to position the legend manually. For different legends I had to change the position argument, because the size of the legend changed. An anchor point for positioning the legend at the top left corner (i put the legend on the right side of the plot) would fix this problem and makes reusing the positioning for many plots usable.\r\n\r\nAn similar problem occured while using xmod and ymod with 'tm_text'. After printing a map into a grid-viewport, the automatic positioning of the labels was wrong (to much space between point coordinates and label), so I set them manually via the `xmod` and `ymod` option. This was somehow time consuming, because I wanted the label left from the coordinates and the position anchor was in the center of the label and had to set different values for labels of different length.\r\n\r\nHere is an example for `tm_text`:\r\n```\r\nlibrary(tmap)\r\ndata(NLD_muni, NLD_prov)\r\n\r\n# autoplacement\r\ntm_shape(NLD_prov) + \ttm_fill(\"population\", style=\"quantile\") + tm_borders() + tm_shape(NLD_muni[c(114,30,50,200),]) + tm_dots(\"green\") + tm_text(\"name\", auto.placement=T)\r\n\r\n# static xmod an ymod\r\ntm_shape(NLD_prov) + \ttm_fill(\"population\", style=\"quantile\") + tm_borders() + tm_shape(NLD_muni[c(114,30,50,200),]) + tm_dots(\"green\") + tm_text(\"name\", auto.placement=F, xmod=2.5, ymod=0.1)\r\n\r\n# mimimc the autoplacement with xmod an ymod - manual adjustment needed for every entry\r\ntm_shape(NLD_prov) + \ttm_fill(\"population\", style=\"quantile\") + tm_borders() + tm_shape(NLD_muni[c(114,30,50,200),]) + tm_dots(\"green\") + tm_text(\"name\", auto.placement=F, xmod=c(1.7,3.5,2.5,2.2), ymod=0.3)\r\n```"},"comment":{"url":"https://api.github.com/repos/mtennekes/tmap/issues/comments/210600151","html_url":"https://github.com/mtennekes/tmap/issues/54#issuecomment-210600151","issue_url":"https://api.github.com/repos/mtennekes/tmap/issues/54","id":210600151,"user":{"login":"mtennekes","id":2444081,"avatar_url":"https://avatars.githubusercontent.com/u/2444081?v=3","gravatar_id":"","url":"https://api.github.com/users/mtennekes","html_url":"https://github.com/mtennekes","followers_url":"https://api.github.com/users/mtennekes/followers","following_url":"https://api.github.com/users/mtennekes/following{/other_user}","gists_url":"https://api.github.com/users/mtennekes/gists{/gist_id}","starred_url":"https://api.github.com/users/mtennekes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtennekes/subscriptions","organizations_url":"https://api.github.com/users/mtennekes/orgs","repos_url":"https://api.github.com/users/mtennekes/repos","events_url":"https://api.github.com/users/mtennekes/events{/privacy}","received_events_url":"https://api.github.com/users/mtennekes/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T19:04:51Z","updated_at":"2016-04-15T19:04:51Z","body":"Thanks! I made some changes. Both legend.position and legend.just should accept a mixture of character and numeric values, for instance `legend.position=c(\"left\", .8)`. I'll test the code this weekend."}}