laserson / squarify

Pure Python implementation of the squarify treemap layout algorithm
Other
293 stars 36 forks source link

Is subgrouping a feature of squarify? #8

Closed robot010 closed 6 years ago

robot010 commented 6 years ago

Hi, I was working on a project where I wanted to use squarify to visualize my dataset. I was wondering if subgrouping is available.

For subgrouping I mean something like this: image

I can see that we can achieve the first level grouping(GROCERY I, DELI, CLEANING, ...), but it seems that we can't further group items within each category.

Please let me know if I'm understanding this correctly, thanks

laserson commented 6 years ago

Hi @Bato803, I'm not sure I understand what functionality you want. Based on the image you point to, you could compute the squares for the top-level of your hierarchy, and run the algorithm again for each subgroup. This functionality is not built-in, but should be rather easy to implement on a case-by-case basis. Let me know if this isn't clear.

abubelinha commented 1 year ago

@robot010 your linked image is not available. I wonder if your idea was to generate a squarified-subgraph inside each box of the original squarify graph. (i.e. something like this representation of World population by continent-subcontinent-country levels, but using Python instead of R; or the example graph in #36).

@laserson do you know of any example codes on how to achieve those nested structures using squarify? Thanks

laserson commented 1 year ago

I am not aware of particular examples, but it should be relatively straightforward by setting the x, y, width, height inputs to squarify parameters for each subgroup that you want. Unfortunately I don't have the bandwidth to write it out.

abubelinha commented 1 year ago

Thanks for suggestion @laserson, I'll see if I can figure that out. But hold on ... does this mean somebody else is already working on the subgrouping feature, so it could be added in the near future? I have just realized about that. I am not a professional programmer, so my github use is almost limited to issues/comments (no idea about using git).

BTW, another project I just found: https://github.com/chenyulue/matplotlib-extra

laserson commented 1 year ago

Yes, check out that PR for the subgroup feature