What would a minimal example for a choropleth map in Mathematica look like?
I can read in a ESRI Shapefile using Import
, but do not know how to work with the imported result.
What would a minimal example for a choropleth map in Mathematica look like?
I can read in a ESRI Shapefile using Import
, but do not know how to work with the imported result.
Just for reference, here some tips for working with ESRI Shapefiles.
CountryData
does not provide county-level data for Germany (the administrative unit is called "Kreis"), which is why I wrote my ownKreisData
function. The shape file I used can be downloaded for free, however there are terms of use to consider.The
KreisData
function is then created as follows:With this function, and the example code by Sjoerd C. de Vries, a map of Germany is created thus:
And why the replacement? If there are no data of the required type for a given country CountryData returns Missing["NotAvailable"], causing
ColorData
, and its underlyingBlend
function not to return a specific RGB value. I replace this unevaluatedBlend
with the color Yellow.Because I cannot resist a Code Golf competition with belisarius:
(for the same result)
A throw on Minimal in the code golf sense: