by taeric · 3y ago · 0 comments
The worst is when someone shows a tree map like viewing of something like a CPU, but that is not at all how those are necessarily logically connected. Such that many go for an odd mix of tree and heat maps, but then fail to actually show anything useful that a simple ordered list couldn't also show.
Showing CPU performance of an application is a pretty neat use case of one type of treemaps too, typically called flamegraphs too, but in reality I think they're just up-side down treemaps :)
i ended up building my own library in react to render various things like what i spend my time in throughout the day (using rescuetime api) to gain better insights into my day. really neat stuff!
Treemaps can be used though, KCachegrind for example uses treemaps much like KDirStat/WinDirStat: https://blog.equanimity.nl/images/qcachegrind.png
> The x-axis spans the sample population. It does not show the passing of time from left to right, as most graphs do. The left to right ordering has no meaning (it's sorted alphabetically to maximize frame merging).
https://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html
> This is a flame graph (which is an adjacency diagram with an inverted icicle layout), using polar coordinates. It is very pretty, and as someone said "it always wows". Sunbursts are the new pie chart. Deeper slices exaggerate their size, and look visually larger. The smaller-looking slice 2 in this image represents 27.7 Mbytes, whereas the larger-looking slice 1 is 25.6 Mbytes. This visualization is actually showing that slice 1 is smaller than slice 2, although I bet most people would think it was the other way around! The problem is that to understand this correctly requires the comparison of angles, instead of lengths or areas, which has been evaluated as a more difficult perceptive task.
https://www.brendangregg.com/blog/2017-02-06/flamegraphs-vs-...
Also, I think flame graphs are easier to implement, and correspond better to the underlying data (fewer visual illusions)
Both of them take tree-shaped data, and a quantity, and you want to attribute the space of the children to the parents. For disk space it's:
100 /home/andy/foo.txt
42 /home/andy/src/bar.txt
For function profiles it's 100 f() g()
42 f() g() h()
So you can use both visualizations with both kinds of data.Also, ncdu is an curses UI for disk space, and I have to admit it's pretty much as effective in practice as tree maps. It doesn't necessarily give you a nice overview though.
A good treemap actually hides the tree structure. (From the link, the GrandPerspective one is good the Baobab one is useless due to the borders/padding). In a tree map you can see siblings, cousins, 2'nd degree cousins of similar importance (size) next to each other and you can see smaller items because size is represented as the surface of a rectangle.
On a flame graph, you can visualise the entire tree in all of it depth but since size is now just length instead of surface it is harder to compare tiny slivers. A flame graph can however be ordered by other criteria than size.
Sunbursts are circular distorted flame graphs and are of dubious utility.
A tree map is not used to see the tree structure. The tree is actually the information that is hidden. Especially if you use the treemap without borders/padding/bezels/names (IMO if you display those it ruins the usability of a treemap). What the tree map is good for is:
- seeing a flat representation of the entire space and therefore instantly seeing the largest files no matter how deeply nested. With a tree or a sunburst you need to drill down from largest folder to largest file because there are only so many concentric rings that can shown. With a flat file list ordered by size you lose all other information.
- seeing rough percentages by type. Maybe you have plenty of small videos taking space. Maybe you have just a few huge videos. Maybe you have one big video and plenty of small ones. All of this can be seen at a glance but is obscured by a summary by file type and is obscured by a sunburst or a tree because of depth.
- seeing the distribution of those file types. Are all of the small videos in the same place? Are they spread around and mixed with other files. Are certain types usually present together? For example if you store RAWs and Jpegs paired together you would be able to see that as a surface of two colors mixed together. If you store RAWs and Jpegs completely separated you would also be able to see that as two distinct surfaces of different colors..
- seeing similar structures. Since a tree map places surfaces near each other if they are neighbours or near neighbors in the tree structure, it is usually easy to spot duplicate trees because they look similar even when they are not identical. A duplicate finder is a separate tool and it also doesn't handle well the scenario of duplicate but changed and therefore not identical.
And, frankly, the actual layout in treemaps is basically arbitrary. Indeed many early "disk utilization" charts that look a lot like treemaps were entirely based on physical location on the disk. As such, the logical layout was not on display, and you were only able to see the physical layout. Which was usually important, as you could see if there were obviously bad sectors or if fragmentation was out of hand.
That is, the very concept of "neighbor" that treemaps show is completely logical in nature, and doesn't really indicate any physical neighboring relationship at all. I suspect that is why I'm not a huge fan of them.
Maybe the treemap lets you hone in on the big files quicker but it only saves a few second’s really as you can expand a folder view to find the offending big files.
expanding subdirectories is suboptimal for me, too disorganized and too many directories to click.
I'll note that the visualizations are neat. And I certainly want to like them. But I also almost always need to know the name of the files more than anything, as it can help me decide how important a file is. If I'm impatient, I can add a `-d3` to the beginning.
I think the tree map examples in the article are missing the padding that you would add to every layer. Apparently, I didn't find any good examples with a quick search. I think this is a crucial feature of tree maps.
[1] https://towardsdatascience.com/make-a-treemap-in-python-426c...