{"action":"created","issue":{"url":"https://api.github.com/repos/d3/d3-scale/issues/90","repository_url":"https://api.github.com/repos/d3/d3-scale","labels_url":"https://api.github.com/repos/d3/d3-scale/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/d3/d3-scale/issues/90/comments","events_url":"https://api.github.com/repos/d3/d3-scale/issues/90/events","html_url":"https://github.com/d3/d3-scale/issues/90","id":196165883,"number":90,"title":"d3.scaleRadial?","user":{"login":"mbostock","id":230541,"avatar_url":"https://avatars.githubusercontent.com/u/230541?v=3","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"mbostock","id":230541,"avatar_url":"https://avatars.githubusercontent.com/u/230541?v=3","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","site_admin":false},"assignees":[{"login":"mbostock","id":230541,"avatar_url":"https://avatars.githubusercontent.com/u/230541?v=3","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-12-16T22:14:24Z","updated_at":"2016-12-17T11:32:23Z","closed_at":null,"body":"To avoid introducing distortion with [radial bars](https://bl.ocks.org/mbostock/6fead6d1378d6df5ae77bb6a719afcb2), you need a scale that smoothly varies from d3.scaleSqrt when the inner radius is zero to d3.scaleLinear when the inner and outer radius are equal. It’s the same principle as [uniform annulus sampling](https://bl.ocks.org/mbostock/d8b1e0a25467e6034bb9).\r\n\r\nHere’s a simplified implementation I came up with:\r\n\r\n```js\r\nfunction scaleRadial() {\r\n  var domain = [0, 1],\r\n      range = [0, 1];\r\n\r\n  function scale(x) {\r\n    var r0 = range[0] * range[0], r1 = range[1] * range[1];\r\n    return Math.sqrt((x - domain[0]) / (domain[1] - domain[0]) * (r1 - r0) + r0);\r\n  }\r\n\r\n  scale.domain = function(_) {\r\n    return arguments.length ? (domain = [+_[0], +_[1]], scale) : domain.slice();\r\n  };\r\n\r\n  scale.range = function(_) {\r\n    return arguments.length ? (range = [+_[0], +_[1]], scale) : range.slice();\r\n  };\r\n\r\n  scale.ticks = function(count) {\r\n    return d3.scaleLinear().domain(domain).ticks(count);\r\n  };\r\n\r\n  scale.tickFormat = function(count, specifier) {\r\n    return d3.scaleLinear().domain(domain).tickFormat(count, specifier);\r\n  };\r\n\r\n  return scale;\r\n}\r\n```\r\n\r\nFor comparison, here’s what a linear scale looks like:\r\n\r\n<img width=\"640\" alt=\"linear\" src=\"https://cloud.githubusercontent.com/assets/230541/21280291/e5405fc6-c399-11e6-9d52-4f93e8daa45e.png\">\r\n\r\nThe area of the largest bar, California, is exaggerated because the bar gets wider as it extends away from the center of the circle: the circumference grows linearly with radius. But a sqrt scale over-fixes the problem, causing the small bars to appear too large:\r\n\r\n<img width=\"640\" alt=\"sqrt\" src=\"https://cloud.githubusercontent.com/assets/230541/21280294/e9b02a14-c399-11e6-9059-271288329b69.png\">\r\n\r\nA sqrt scale only works when the inner radius is zero. Here is area-proportional result using the proposed “radial” scale:\r\n\r\n<img width=\"640\" alt=\"radial\" src=\"https://cloud.githubusercontent.com/assets/230541/21280297/edaee09c-c399-11e6-83b7-a2def2e198ca.png\">\r\n"},"comment":{"url":"https://api.github.com/repos/d3/d3-scale/issues/comments/267757898","html_url":"https://github.com/d3/d3-scale/issues/90#issuecomment-267757898","issue_url":"https://api.github.com/repos/d3/d3-scale/issues/90","id":267757898,"user":{"login":"Fil","id":7001,"avatar_url":"https://avatars.githubusercontent.com/u/7001?v=3","gravatar_id":"","url":"https://api.github.com/users/Fil","html_url":"https://github.com/Fil","followers_url":"https://api.github.com/users/Fil/followers","following_url":"https://api.github.com/users/Fil/following{/other_user}","gists_url":"https://api.github.com/users/Fil/gists{/gist_id}","starred_url":"https://api.github.com/users/Fil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fil/subscriptions","organizations_url":"https://api.github.com/users/Fil/orgs","repos_url":"https://api.github.com/users/Fil/repos","events_url":"https://api.github.com/users/Fil/events{/privacy}","received_events_url":"https://api.github.com/users/Fil/received_events","type":"User","site_admin":false},"created_at":"2016-12-17T11:32:23Z","updated_at":"2016-12-17T11:32:23Z","body":"Looks rather specific, and I wonder if a more generic version wouldn't be more useful.\r\n\r\nSomething like `rescale(s = d3Scale.scaleLinear(), x =>   Math.sqrt(s(x)));` "}}
{"actor":{"display_login":"Fil"}}