Creating a SVG Map: Women in the Parliament

Nathan Yau‘s book, Visualize This, is a book for learning by reading and doing. The theory and concepts explained are stated clearly and colloquially, as if it were a great master class, in the same way that the examples are explained step by step, and detailing the reason behind each line of code.

I liked several graphs, their practical application and the way they allow you to visualize the data. I have already included another example (inspired by the book) corresponding to the use of a heatmap.

In this case, take as an example the practical case shown in the section Map Countries from Chapter 8: Visualizing spatial relationship about how to process countries using SVG map.

1 SVG File for World

SVG files are XML files. It can be easily edit it using a text editor. So, you can edit the color into the file, the XML tells the browser what to show, such as the color and the images.

2 Coloring the countries

I used the designer.colors function in R (in the fields package) to make a linear scale of 256 ‘new’ colors.