igraph half circle layout in R -


i trying various visualizations igraph in r (version.3.3.1). visualizing shown below, 2 nodes (blue , green) in circular layout.

circular layout

 visnetwork(data$nodes,data$edges) %>% visigraphlayout(layout="layout_in_circle")  

now want have semicircle structure instead of full circle in pic. blue nodes form semicircle, green nodes semicircle. each semicircle separated small distance well. how can achieve this. found grid package has option semicircle, couldnt make work igraph. please provide pointers.

the layout argument accepts arbitrary matrix 2 columns , n rows if graph has n vertices; need create list of coordinates correspond semicircle. can make use of fact vertex @ angle alpha around circle radius r centered @ (0, 0) found @ (r * cos(alpha), r * sin(alpha)). since using r, alpha should specified in radians, spaced evenly between 0 , pi (which corresponds 180 degrees).


Comments