Saturday, August 15, 2015

Champion Tree Map: Dynamic Custom Shapes and Web Scraping

This blog post serves as a "how-to". For a more general post about the champion tree map see here.

This is the closest I've come to a "Pimp my Viz" submission. For a moment I thought two different graphical representations of tree shape was too crowded for one dashboard, but I like them both too much. Here's how I got there.

The Data: American Forests

The nonprofit American Forests has over 700 champion tree pages- one for each tree. I used, a free web extraction tool, to collect the American Forests data. This was a two step process- first use their extractor tool on their tree search page to get a table of all of the champion trees and their URLs. I then trained the extractor tool on individual tree pages and fed it the URL table to get a data set of all champion trees and their dimensions.

Screenshot of training on a tree page.
One drawback of the resulting data set is the location data is somewhat inconsistent. Some locations are a county, some a city, and some a national park. I didn't know an easy way to deal with this, so I looked up the latitude and longitude for the largest 240 trees by hand. This was relatively quick on and took me about 90 minutes.

Dynamic Custom Shapes

I made my first tree map a few months ago using Atlanta data and circles for each tree. I avoided tree shapes the first time because I thought it would look chart-junky. But this time I figured out how to make the tree shape proportional to the actual height, canopy size, and trunk width of the tree, so each image adds unique information.

How can we display all these unique tree shapes?!
Tableau custom shapes are easy to implement, but are designed for dimension variables- a different shape for each discrete value. They can vary in size on one continuous variable, but I wanted my trees to vary in size with respect to three independent dimensions- height, trunk, and canopy. To add a second size dimension, I created a bin on the height to canopy ratio, and assigned different-sized canopy images to each bin. To add a third size dimension, I used a dual axis map and did the same thing for trunks that I did for canopies. By assigning images based on the height to trunk and height to canopy ratios, I was then able to make the overall image size proportional to height, and all three variables are in correct proportion to each other and other trees. (I actually used height^1.6 as the size variable to get the proportions right- because the image size scale is based on area, not height.)

Canopy image for .5x height to canopy ratio.
Canopy image for 3.5x height to canopy ratio.

The two images above are examples. The top was used for trees whose total height is half the width of the canopy, and the bottom was used for trees with a height 3-4 times greater than the canopy width. Note that both PNG images use the same size canvas so Tableau will size them correctly when scaling for height. Both images leave space for the trunk at the bottom too. This keeps the trunk and canopy from overlapping on the dual axis graph. (I used the same image size for the trunk and kept them on the bottom half.)

A sad clear cut and weird green clouds- the workbook before selecting dual axis.
Tree Graph Bar Graph

I like the tree map, but their scattered locations and small size makes it hard to really compare different trees. So I added the "tree graph bar graph" at the bottom. To make this graph, I created a dual-axis bar graph, with one series of graphs for the canopies, and on for the height. I then played with the axes settings to make the trunk stand out below the canopies.

Tree graph before selecting dual axis
Final Touches

Final touches included a highlight action from the graph to the map, a dynamic sort on the bar graph, and background color for both the map and the bar graph. I usually keep backgrounds white to keep focus on the data, but in this case I enjoyed using colors consistent with nature.


  1. Web amusements are turning into the greatest mechanical flood of the millenium. Numerous.moviebox download

  2. web recreations resemble unscripted television emulating genuine situations. Everybody with. itube download

  3. access to the interent has admittance to these internet amusements. Some of these web. vidmate download

  4. Pokemesh go is new revolution in gaming world with lots of new features , its an advance version of Pokémon, try it fast for better gaming experience.
    Pokemesh app

  5. Also, Android application improvement is blossoming all the more quickly, as clients want more components and utility in their handheld it

  6. Tree pruning and trimming services also help in the beautification of the property which will subsequently increase the land value. Trees can also be maintained in such a way that adequate privacy is given to the inmates of a house. Click here now

  7. Interesting blog!
    You could also try the free web scraping tool Octoparse( to collect the web data. Thanks.

  8. Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. Thank you so much for caring about your content and your readers.

  9. We are Mona Media, professional website development agency in Vietnam with have more than 8+ year experience. We mostly design and develop PHP and .NET website

  10. we come ahead with a wide array of services ranging from research and business analysis for various genres of web development. We also deal in developing and designing business applications, websites, customized software and promotional landing pages. Web development companies