Titles can be set on treemaps easily if we keep in mind margins.
Normally we simply set titles by using:
text: "Title text here"
For treemaps, this is only half the solution. We also have to set margins so that the treemap title is revealed.
Setting margins for title would look something like this:
margin: "40 0 0 0"
Using both these code blocks we can see the title for treemaps. Here is an example of how treemap is set: