Description Usage Arguments Details Value Examples

View source: R/circleProgressiveLayout.R

Arranges a set of circles, which are denoted by their sizes, by consecutively placing each circle externally tangent to two previously placed circles while avoiding overlaps.

1 | ```
circleProgressiveLayout(x, sizecol = 1, sizetype = c("area", "radius"))
``` |

`x` |
Either a vector of circle sizes, or a matrix or data frame with one column for circle sizes. |

`sizecol` |
The index or name of the column in |

`sizetype` |
The type of size values: either |

Based on an algorithm described in the paper:
*Visualization of large hierarchical data by circle packing*
by Weixin Wang, Hui Wang, Guozhong Dai, and Hongan Wang. Published
in *Proceedings of the SIGCHI Conference on Human Factors in Computing Systems*,
2006, pp. 517-520 https://dl.acm.org/citation.cfm?id=1124851

The implementation here was adapted from a version written in C by Peter Menzel: https://github.com/pmenzel/packCircles.

A data frame with columns: x, y, radius. If any of the input size values
were non-positive or missing, the corresponding rows of the output data frame
will be filled with `NA`

s.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
areas <- sample(c(4, 16, 64), 100, rep = TRUE, prob = c(60, 30, 10))
packing <- circleProgressiveLayout(areas)
## Not run:
# Graph the result with ggplot
dat.gg <- circleLayoutVertices(packing)
ggplot(data = dat.gg, aes(x, y, group = id)) +
geom_polygon(colour = "black", fill = "grey90") +
coord_equal() +
theme_void()
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.