Visualization issues related to hierarchical division

Dear Professor Tiago P. Peixoto
Hello, I’m encountering a problem in part of Inferring modular network structure. Specifically, how can I transform Figure 1 into a visualization method similar to Figure 2?

figure 1.

figure 2.

In my network-based urban research, I’ve found that the visualization method in Figure 2 is more intuitive and easier to understand. I’ve tried for a long time but haven’t been able to achieve satisfactory visualization results.

I hope you can provide an answer. Thank you.

zhanxiang chen

The visualization is the bottom has been made “by hand” using latex and TikZ as an explanatory diagram for a paper. I’m afraid there’s no code to produce it automatically.