Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have not idea how to call these things, but I just saw a paper with the following figure

enter image description here

and I was wondering how one would go about doing it in LaTeX. The closest thing I saw on TeXample.net was the Ford Circles example, but that's for a very specific case. I would like to see a way use this as a plotting device. At this point, I am not even sure how to do it in "normal" programming language, so perhaps the question is ill-placed.

At any rate, I'd love to hear what people think!

share|improve this question
The scaling and colorizing of the small circles is trivial. On the other hand, the positioning of multiple circles of arbitrary sizes so that they don't overlap, and at the same time are compactly arranged within one big container circle is a hard problem. Writing a general algorithm for this may be an interesting exercise in a real programming language; in TeX, I would only attempt it had absolutely nothing else to do, for example if I were serving a life sentence in prison. Oh and I would have to be much younger too. –  Michael Palmer Jan 17 '12 at 22:08
Any idea on what this problem is called? just so I could search for it in other "circles" (ha!) –  Yossi Farjoun Jan 17 '12 at 22:12
@YossiFarjoun: I believe they're called circular treemaps. Not sure they're the best way to communicate data, but they're very pretty =) –  Jake Jan 17 '12 at 22:56
Most treemaps use rectangles instead of circles. If you could use those, there's an R package for doing that. See this blog for a very straightforward tutorial. –  Alan Munn Jan 18 '12 at 3:07
Wikipedia has a decent-looking article on "circle packing" that may be useful. –  Michael Palmer Jan 18 '12 at 4:44
show 3 more comments

3 Answers

As already observed by Michael Palmer your question boils down to a circle packing problem. I am not an expert in the subject but I know at least one person who is. His name is Ken Stephenson from University of Tennessee. Please check out his gallery! He is also providing algorithms and Java based software which can be used to create those magnificent pictures on his webpage.

On the another hand, I am very interested in an alternative solution in the classical sense of Mittag Leffler (power series) of N-body problem which is solved for 3 bodies by Karl Sundman and N>3 by my Ph.D. advisor Qiudong Wang. The solution boils down to a construction of the explicit Riemann mapping which can be done algorithmically via discrete version of Riemann mapping (circle packing). If you would like to look into that problem please contact me via private e-mail and we can try to write a paper together.

Sorry, no TeX answer here and probably even if we attack problem we will not use TeX as a programming language but very interesting problem never the less.

share|improve this answer
hmmm. somewhat out of my league. While I am a mathematician, I haven't done this kind of math...sounds interesting, but I don't think I will be able to contribute anything... –  Yossi Farjoun Jan 19 '12 at 19:02
add comment

I found a java implementation which is a fun way to take a look at your directory structure. It also allows arbitrary .xml files as input, but I didn't see a nice way to save as .png or similar.

The implementation also leaves something to be desired, as this screenshot shows: enter image description here

(it was genenerated by taking all the files in my home directory, and creating an xml file with one level, and the files' sizes are the size of the circles)

I have no desire to transfer it to LaTeX....though...maybe better to write a python script and input the circle centers and radii into LaTeX.

share|improve this answer
add comment

run with latex->dvips->ps2pdf




enter image description here

share|improve this answer
This won't work for arbitrary circle sizes though, so it doesn't help for plotting data. Rather, it's a specific case, like the Ford circles Stefan linked to in his question. –  Jake Jan 20 '12 at 8:21
it is an idea, how it can be done. And if someone like it with other circle radi, then we can think about it ... –  Herbert Jan 20 '12 at 9:47
pretty. does not answer the question, but pretty. :-) –  Yossi Farjoun Jan 20 '12 at 17:52
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.