Example: Visualizing Custom Data on a Choropleth Map - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Statistics and Data Analysis : DataSets Package : Example: Visualizing Custom Data on a Choropleth Map

Visualizing Custom Data on a Choropleth Map


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 (accessed 9 April 2017)

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......


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.


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


Highest fertility value:

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

c2RGB : 0.902 0.902 0.588


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]);