I'm still working to do some additional graphs for the project mentioned in this earlier post. It was too crowded with the Fruchterman Reingold layout, so my customer suggested we do a circular layout with one category in the center and the remaining on the outer ring. I said sure! But when I went to do it, I found only star layout (one in the center) and ring layout. No polar layout. I tried a few things but finally broke down and asked. Quick perfect answer on StackOverflow (as often happens).

That led to this:

But hey, still pretty jammed up. So what about an ellipse? Sure!

What's that equation again?

But that's a hard way to do it when I need x and y values in a matrix. This looks better:

And this is how I did it.

`ellip.layout <- function(a,b, theta) {`

cbind(a*cos(theta), -b*sin(theta))

}

systems <- which(V(g)$category == "System")

comp <- which(V(g)$category != "System")

a<- ifelse(V(g)$category == "System",4,5)

b<- ifelse(V(g)$category == "System",0.5,1)

theta <- rep.int(0, vcount(g)) #creates a blank vector

theta[systems] <- (1:length(systems)-1) * 2 * pi / length(systems)

theta[comp] <- (1:length(comp)-1) * 2 * pi / length(comp)

layout<- ellip.layout(a,b,theta)

plot.igraph(g, layout=layout, asp=0)

Originally I was getting the outer ring to be a circle anyway, but then I asked the mailing list and it was a matter of setting asp (aspect ratio) to 0.

Here's where I ended up:

ETA: If you do labels, there's a neat trick to make them always outside the circle. See here: https://gist.github.com/kjhealy/834774