Re: [R] Parliament Seats Graph

2014-09-12 Thread Jim Lemon
On Mon, 8 Sep 2014 10:22:03 PM Stefan Petersson wrote: Hi, Is there any package (or homegrown function) that can produce Parliament Seats Graph? I'm referring to the nice looking concentric half circles of colored seats as seen on Wikipedia (for example). I can pretty easily plot the

Re: [R] Parliament Seats Graph

2014-09-12 Thread Barry Rowlingson
On Fri, Sep 12, 2014 at 11:25 AM, Jim Lemon j...@bitwrit.com.au wrote: I can see how you would plot the points going from right to left (the easy way), by plotting the next point on the arc with the least increase in angle from the last point plotted. If this is the way you have worked out, I

Re: [R] Parliament Seats Graph

2014-09-12 Thread Stefan Petersson
Yes. That's correct. The main problem is to solve a matrix where the colSums and rowSums are known. Credits to dwinsem...@comcast.net for pointing out the function r2dtable to me. Just feed it with the known margins and the number of matrices You want. And Bob is Your uncle! Look at the thread

Re: [R] Parliament Seats Graph

2014-09-12 Thread Duncan Murdoch
On 12/09/2014, 7:18 AM, Barry Rowlingson wrote: On Fri, Sep 12, 2014 at 11:25 AM, Jim Lemon j...@bitwrit.com.au wrote: I can see how you would plot the points going from right to left (the easy way), by plotting the next point on the arc with the least increase in angle from the last point

Re: [R] Parliament Seats Graph

2014-09-12 Thread Barry Rowlingson
I've generalised Duncan's code: seats - function(N,M, r0=2.5){ radii - seq(r0, 1, len=M) counts - numeric(M) pts = do.call(rbind, lapply(1:M, function(i){ counts[i] - round(N*radii[i]/sum(radii[i:M])) theta - seq(0, pi, len = counts[i]) N - N -

Re: [R] Parliament Seats Graph

2014-09-12 Thread Barry Rowlingson
Note if you are trying to compare parliament diagrams created with this code with images from wikipedia, the wikipedia images I tried are wrong. The Ukrainian one: http://en.wikipedia.org/wiki/Verkhovna_Rada shows two groups in red but the legend only has one red party, and the French Senate:

[R] Parliament Seats Graph

2014-09-08 Thread Stefan Petersson
Hi, Is there any package (or homegrown function) that can produce Parliament Seats Graph? I'm referring to the nice looking concentric half circles of colored seats as seen on Wikipedia (for example). I can pretty easily plot the points and color them. But I can't group the colored points in