Yes exactly!! It took me a bit too long to realize that treemaps visualize the same structure as flame graphs, and I like flame graphs better
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.