Purgeable storage space

When you use Purple Tree you’ll probably notice a difference between the free disk space displayed by the app and the free space displayed by Finder and other system tools, which would be higher if you activated the Mac storage optimization.

In this case the free space displayed by macOS can be a fake ! It includes really unoccupied space and also purgeable space. The latter IS occupied by data, but could be freed by the system (concerns iCloud based data like pictures, apps, podcasts etc). The disk space displayed by Purple Tree is the same as given by the shell command:

df -H

More about purgeable storage on Apple support site.

APFS and some side effects

APFS or Apple File System was introduced in 2017 in macOS High Sierra. Some of its most important features aim to reduce the disk space used by files, such as ‘clones’. There are some considerations to keep in mind, when analyzing the disk space:
First, when a file is copied on the same Volume its contents are not duplicated, though those files can be considered as duplicates by Purple Tree. 
Now, even if this file is modified, the unmodified parts of it are not duplicated. Therefore the file sizes are merely an indication. The sum of every file sizes can actually be higher than the Volume size itself!

File cloning principle: unchanged blocks are not duplicated. Image from Apple Developer

Read more in this article on Apple Developer site.

About Treemaps

Treemap visualization of hierarchical data was introduced in 1991 by Ben Schneiderman from the University of Maryland. Purple Tree uses a modified version of the Squarified layout algorithm introduced by Jarke J. van Wijk et al. This layout avoids high aspect ratio rectangles making comparison of two areas easier. The areas of two files of equal size should appear as equal for the same tree layer. However, the nested file drawing may alter the apparent area because of the margins, so thin margins lead to more visual accuracy.