Wednesday, September 18, 2019

Voronoi Mandalas

SciPy has tools for creating Voronoi tessellations. Besides the obvious data science applications, you can use them to make pretty art like this:
The above was generated by this code:




I started with Carlos Focil's mandalapy code, modifying the parameters until I had a design I liked. I decided to make the Voronoi diagram show both points and vertices, and I gave it an equal aspect ratio. Carlos' mandalapy code is a port of Antonio Sánchez Chinchón's inspiring work drawing mandalas with R, using the deldir library to plot Voronoi tesselations.

5 comments:

  1. This is really cool, thank you for posting it!

    You can remove the comment about needing to change dashed to solid in _plotutils.py I believe, I can reproduce your image without doing that.

    I'm one of the SciPy maintainers and would love to include your code and image into the SciPy docs or website somewhere. Would you be okay with that? The original R code is MIT-licensed, so it seems feasible (Carlos Focil would also need to agree of course).

    ReplyDelete
    Replies
    1. Hi Ralf, that would be great!. Feel free to include the code. It is possible to include somewhere a link to the github repository?

      Thanks for asking!

      Delete
    2. I don't have a user in this website, and my comment appears as "Unknown", but I'm Carlos Focil. If you have further comments or questions you can contact me at carlosfocil09@gmail.com

      Best

      Delete
  2. Ralf, thanks so much for your comment! Wow, that would be awesome! Yes, ask Carlos :)

    I removed the comment because the dashed lines match my plot indeed. I believe the original intention of Carlos' comment was to replicate Antonio's images that had solid lines. Thanks for bringing that up - your comment inspired me to dig deeper into understanding the internals of voronoi_plot_2d() and learning.

    ReplyDelete
  3. Awesome, thank you both Audrey and Carlos! I'll open a PR soon where I'll Cc and credit both of you.

    ReplyDelete