Simon P. Ditner


Treemap - Create Treemaps from various sources of data.


 #!/usr/bin/perl -w
 use Treemap::Squarified;
 use Treemap::Input::Dir;
 use Treemap::Output::Imager;
 my $dir = Treemap::Input::Dir->new();
 my $imager = Treemap::Output::Imager->new( WIDTH=>1024, HEIGHT=>768, 
                                            FONT_FILE=>"ImUgly.ttf" );
 $dir->load( "/home" );
 my $treemap = new Treemap::Squarified( INPUT=>$dir, OUTPUT=>$imager );
 $imager->save( "test.png" );


This base class is not meant to be directly instantiated. Subclasses of Treemap which implement specific Treemap layout algorithms should be instantiated instead. See the SEE ALSO section below for a list.

Traditional representations of hiarchal information trees are very space consuming. There is a large amount of redundant information and padding to convey the tree structure.

Treemaps are representations of trees that use space-filling nested rectangles to convey the tree structure.

e.g., a directory tree:

   2       ./CVS/Root
   2       ./CVS/Repository
   2       ./CVS/Entries
   2       ./CVS/Entries.Log
   10      ./CVS
   2       ./Treemap/CVS/Root
   2       ./Treemap/CVS/Repository
   2       ./Treemap/CVS/Entries
   2       ./Treemap/CVS/Entries.Log
   (goes on for 80 lines)

e.g., a treemap of a directory tree:

 |             ROOT              |
 ||ImUgly.ttf ||Treemap||  CVS  ||
 ||           ||.-----.||       ||
 ||           |||Input|||       ||
 ||           |||     || >-----< |
 ||           || >---< ||example||
 ||           |||Outpu|||       ||
 ||           ||`_____'||       ||

Raster output is much more useful (like a GIF, or PNG) than ascii, as the labels are scaled appropriately, and alpha transparency is used to show information that would otherwise be hidden.



A Treemap::Input object reference.


A Treemap::Output object reference.


Distance between in a parent rectangle, and all it's children in points. Points being whatever unit of measurement the drawing routines of the output object uses.


Spacing around the outside of a rectangle in points. Points being whatever unit of measurement the drawing routines of the output object uses.

For a wondeful surprise, set PADDING, and SPACING to zero. It's more difficult to see the nesting, but it reveals other structures that you likely won't see unless you render your treemap at an extremely high resolution.


Perform the actual operation of treemapping.


None by default.


Treemap Layout Classes:

Treemap::Strip, Treemap::Squarified

Treemap Input Classes:


Treemap Output Classes:



Subclasses should autoload in some manner to ease developer use.

Violates data incapsulation, and reaches into the innards of Treemap::Input objects. It really shouldn't do that.


Simon Ditner <>, and Eric Maki <>


Original Treemap Concept: Ben Shneiderman <>,


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 312:

=back doesn't take any parameters, but you said =back 4

Around line 322:

=back doesn't take any parameters, but you said =back 4