Graphics Programs Reference
In-Depth Information
MAP CouNTrIES
The process to color counties in the previous example isn't exclusive to
these regions. You can use the same steps to color states or countries. All
you need is an SVG file with unique ids for each region you want to color
(which are easily accessible on Wikipedia) and data with ids to match. Now
try this out with open data from the World Bank.
World Bank
is one of the
most complete
resources for
country-specific
demographic
data. I usually
go here first.
Look at percentages of urban populations with access to an improved water
source, by country, in 2008. You can download the excel file from the World
Bank data site here: http://data.worldbank.org/indicator/SH.H2O.SAFE.UR.ZS/
countries . For convenience, you can also download the stripped down data
as a CSV file here: Full URL is: http://book.flowingdata.com/ch08/worldmap/
water-source1.txt . There are some countries with missing data, which is
common with country-level data. I've removed those rows from the CSV file.
There are seven columns. The first is the country name; the second is a
country code (could this be your unique id?); and the last five columns are
percentages for 1990 to 2008.
For the base map, again go to Wikipedia. You can find a lot of versions when
you search for the SVG world map, but use the one found here: http://
en.wikipedia.org/wiki/File:BlankMap-World6.svg . Download the full resolution
SVG file, and save it in the same directory as your data. As shown in Fig-
ure 8-21, it's a blank world map, colored gray with white borders.
FIGurE 8-21 Blank world map
Search WWH ::




Custom Search