Graphics Programs Reference
In-Depth Information
CrEATE A TrEEMAP
Illustrator doesn't have a Treemap tool, but there is an R package by Jeff
enos and David Kane called Portfolio. It was originally intended to visual-
ize stock market portfolios (hence the name), but you can easily apply it to
your own data. Look at page views and comments of 100 popular posts on
FlowingData and separate them by their post categories, such as visual-
ization or data design tips.
R is an open-
source software
environment for
statistical comput-
ing. You can
download it for
free from www
.r-project.org/ .
The great thing
about R is that
there is an active
community around
the software that
is always develop-
ing packages to
add functionality.
If you're looking to
make a static chart,
and don't know
where to start,
the R archives are
a great place to
look.
As always, the first step is to load the data into R. You can load data
directly from your computer or point to a URL. Do the latter in this example
because the data is already available online. If, however, you want to do the
former when you apply the following steps to your own data, just make sure
you put your data file in your working directory in R. You can change your
working directory through the Miscellaneous menu.
Loading a CSV file from a URL is easy. It's only one line of code with the
read.csv() function in R (Figure 5-17).
posts <- read.csv(“http://datasets.flowingdata.com/post-data.txt”)
FIGurE 5-17 Loading CSV in R
easy, right? We've loaded a text file (in CSV format) using read.csv() and
stored the values for page views and comments in a variable called posts . As
mentioned in the previous chapter, the read.csv() function assumes that your
data file is comma-delimited. If your data were say, tab-delimited, you would
use the sep argument and set the value to \t . If you want to load the data from
a local directory, the preceding line might look something like this.
posts <- read.csv(“post-data.txt”)
Search WWH ::




Custom Search