Graphics Programs Reference
In-Depth Information
P The New York
Times used an
animated treemap
to show changes
in the stock
market during the
financial crisis
in its piece titled
“How the Giants
of Finance Shrank,
Then Grew, Under
the Financial
Crisis.” See it in
action at http://
nyti.ms/9JUkWL.
FIGurE 5-18 Default treemap in R
For this particular graphic you need to change the scale of the legend
that goes from -90 to 90. It doesn't make sense to have a negative scale
because there's no such thing as a negative number of comments. You can
also fix the labels. Some of them are obscured in the small rectangles.
Size the labels by popularity instead of the uniform scale it now has using
the Selection tool. Also thicken the category borders so that they're more
prominent. That should give you something like Figure 5-19.
There you go. The graphic is much more readable now with unobscured
labeling and a color scale that makes more sense. You also got rid of the
dark gray background, which makes it cleaner. Oh, and of course, you
included a title and lead-in to briefly explain what the graphic shows.
Because the Portfolio package does most of the heavy lifting, the only
tough part in applying this to your own data is getting it into the right
format. Remember, you need three things. You need a unique id for each
row, a metric to size rectangles, and parent categories. Optionally, you
can use a fourth metric to color your rectangles. Check out Chapter 2,
“Handling Data,” for instructions on how to get your data into the format
you need.
Search WWH ::




Custom Search