Visualizing Custom Data on a Choropleth Map - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Applications and Example Worksheets : Statistics : examples/DataSets/Choropleth/CustomData

Visualizing Custom Data on a Choropleth Map

Introduction

This application generates a choropleth map visualizing the average number of children born to a woman in a number of European countries for the calendar year 2015.

 

Data source: Eurostat - http://ec.europa.eu/eurostat/tgm/table.do?tab=table&init=1&language=en&pcode=tsdde220

Data Description: The mean number of children that would be born alive to a woman during her lifetime if she were to survive and pass through her childbearing years conforming to the fertility rates by age of a given year.

Import fertility rate data

First a DataFrame is created to contain the data set. Note that this data is for the year 2015.

FertilityData := Import("datasets/fertility_rates.csv", base = datadir);

FertilityDataFertility Rate - 2015Belgium1.7Bulgaria1.53Czech Republic1.57Denmark1.71Germany1.5Estonia1.58Ireland1.92Greece1.33......

(2.1)

Generate a world map and restrict the view to Europe

The WorldMap command creates a WorldMap object that can be used to display maps of the world in various ways.

europeMap := DataSets:-Builtin:-WorldMap():

The SetView command restricts the view frame for the World map to a given area.

SetView(europeMap,-11,36,32,87):

Define the colors used to shade the map

In the following section, we define two colors to be used to generate the gradient in the ChoroplethMap.


Lowest fertility value:

c1 := ColorTools:-Color("RGB",[0/255,55/255,0/255]);

c1RGB : 0 0.216 0

(4.1)

Highest fertility value:

c2 := ColorTools:-Color("RGB",[230/255,230/255,150/255]);

c2RGB : 0.902 0.902 0.588

(4.2)

Generate a choropleth

The ChoroplethMap command generates a map that is shaded in proportion to the measurements for the displayed variable, the fertility rate. The plots:-display

FertilityMap := ChoroplethMap(europeMap, FertilityData, [c1, c2], mapdata=fine, watercolor="White"):

Additional plot options can be added using the plots:-display command:

plots:-display(FertilityMap, axes = none, size = [800, 800], title = "Number of Children Per Female (2015)", titlefont = [Arial, Bold, 18]);