Nov 13, 2009

Make a US county thematic map using Mathematica

I read a blog entry How to Make a US County Thematic Map Using Free Tools. The idea is to use Python script to modify the style settings in SVG file to make the most recent unemployment map. Mathematica can’t import SVG file directly, however, SVG file is in XML format, it is very easy to extract the necessary data from SVG file. If you are not sure what’s going here, please refer to the original blog.

All the files are zipped together, just unzip it, run the notebook. Download it here.

usamap

4 comments:

Dem_z said...

Very cool!! Thanks for keeping your blog updated!!

I'm not too sure about the 255 in the line colorsystem =
RGBColor @@@ ({{241, 238, 246}, {212, 185, 218}, {201, 148,
199}, {223, 101, 176}, {221, 28, 119}, {151, 0, 67}}/255);... I removed it, and it generates the same image, why would you divide the colours by 255?

Sander Huisman said...

RGBColor accepts 3 values; red, green, and blue, these should be scaled between 0 and 1.

Unknown said...

Very useful! However, it would be even more useful with a legend. I see how to add a legend to plots. Is there a way to add a legend to this type of graphic? Or, is there a way to overlay values (i.e. the actual unemployment data) onto the map itself. Thanks so much for your examples.

Mathematica fan said...

THANK you so much for putting this together. I needed to generate a heatmap plot by county for an academic paper, and within minutes of googling I found your helpful post. Thanks again!