ChoroplethMap - Maple Help

DataSets[Builtin][WorldMap]

 ChoroplethMap
 create and display a plot for a WorldMap object

 Calling Sequence ChoroplethMap(m,dataTable) ChoroplethMap(m,dataTable,colorlist,options,plotopts) ChoroplethMap(m,countries,data) ChoroplethMap(m,countries,data,colorlist,options,plotopts) ChoroplethMap(m,ref) ChoroplethMap(m,ref,colorlist,options,plotopts)

Parameters

 m - a WorldMap object dataTable - a table, Matrix, Array, DataSeries, or DataFrame. countries - a list or one-dimensional Array or Matrix of country identifiers in the form of country names, ISO 3166 two- or three-letter country codes, or top level internet domain country codes. These name types may be mixed, and can be formatted as strings or names. data - a list or one-dimensional Array or Matrix consisting of a data item for each country in countries, arranged in the same order ref - a DataSets[Builtin][Reference] object consisting of two columns options - (optional) keyword options of the form option=value, where option can be colorlist, grid, markers, projection, transformdata, or watercolor plotopts - (optional) plot options

Options

 • colorlist : a list of colors to be used for the gradient. If not provided, the default value is the first two colors of the currently selected palette.
 • grid : truefalse; controls the display of a grid of so-called graticule lines: curves of constant latitude and curves of constant longitude. By default, grid is set to be false. If it is true, this command shows latitude and longitude curves both at intervals of 15 degrees.
 • markers : sets the proportion of the range of data falls in each color range. For more details, see the plot gradient color schemes help page.
 • projection : specifies the name of the supported map projection to use. The default projection is MillerCylindrical. See ListOfProjections for a complete list of supported map projections.
 • transformdata : option can be used to apply a function to the data before it is colored. For more details, see the plot gradient color schemes help page.
 • watercolor : color object, plot color, or a color string recognized by ColorTools; specifies the color of oceans and other bodies of water.

Description

 • The ChoroplethMap command creates and displays a map plot for m, with countries colored according to the given set of data.
 • If TimeSeries data is provided through a DataSets[Builtin][Reference] object, then an animation is created, with each point in time corresponding to one frame.
 Note: In this case, the procedure may take a long time to run. Creating an animation with the Globe projection is particularly slow, and is not advised.
 • Regions with the smallest data values are shaded with first color listed in colorlist, regions with the largest data values are shaded with the last color listed in colorlist, and the values in between transition through the other colors, in order, listed in colorlist.
 • Regions with no data, or with data which is undefined, are highlighted in a light shade of grey.
 • If a table is passed to ChoroplethMap, an index-entry pair corresponds to a country (the index) and its data (the entry).
 • If an Array or Matrix is passed, the first column should contain country names, and the second should contain the corresponding data. The rtable must have exactly two columns.
 • If a DataSeries or DataFrame is passed, it must have a single column. The row labels must be the country names and the column must hold the corresponding data.
 • If a DataSets[Builtin][Reference] object is passed, the element names should correspond to the country names, and the data contained in the reference should be the corresponding data.

Examples

 > $m≔\mathrm{DataSets}:-\mathrm{Builtin}:-\mathrm{WorldMap}\left(\right)$
 ${m}{≔}\left(\begin{array}{cc}\left[{\mathrm{PLOT}}{}\left({\mathrm{...}}\right)\right]& \begin{array}{c}{\mathrm{A map of the world}}\\ {\mathrm{projection: MillerCylindrical}}\end{array}\end{array}\right)$ (1)

Highlight Australia, Brazil, Canada, Denmark, and Egypt.

Canada, with the central data value, is colored red, since red is the color in the center of the colorlist.

Brazil and Denmark (including Greenland) are colored with intermediate colors, in accordance with their data values.

 > $\mathrm{ChoroplethMap}\left(m,\left["Australia","Brazil","Canada","Denmark","Egypt"\right],\left[1,2,3,4,5\right],\left["green","red","blue"\right]\right)$

Display an animation of population over time.

The transformdata option is used to apply the natural logarithm to the data is colored, so that the impact of outliers with very large or very small populations on the coloring is reduced.

Note that it will take some time for data to be loaded.

 > $\mathrm{countries}≔\mathrm{DataSets}:-\mathrm{Builtin}:-\mathrm{Reference}\left("Country"\right):$
 > $\mathrm{pop}≔\mathrm{countries}\left[..,"Population"\right]:$
 > $\mathrm{DataSets}:-\mathrm{Builtin}:-\mathrm{WorldMap}:-\mathrm{ChoroplethMap}\left(m,\mathrm{pop},\left["red","yellow"\right],'\mathrm{transformdata}'=\mathrm{log}\right)$

Display the coastline length of various countries, using a different projection and a different transformation: many countries have coastline length 0, so taking the logarithm would yield minus infinity. Instead, we add 1 to each coastline length before taking the logarithm.

 > $\mathrm{coastlines}≔\mathrm{countries}\left[..,"Coastline"\right]$
 ${\mathrm{coastlines}}{≔}\left[\begin{array}{cc}{\mathrm{Country \left(Name\right)}}& {\mathrm{Coastline}}\\ {\mathrm{Afghanistan}}& {0}\\ {\mathrm{Albania}}& {362.}{}⟦{\mathrm{km}}⟧\\ {\mathrm{Algeria}}& {998.}{}⟦{\mathrm{km}}⟧\\ {⋮}& {⋮}\\ {\mathrm{\left(182 more\right)}}& {}\end{array}\right]$ (2)
 > $\mathrm{DataSets}:-\mathrm{Builtin}:-\mathrm{WorldMap}:-\mathrm{ChoroplethMap}\left(m,\mathrm{coastlines},\left["red","yellow"\right],\mathrm{=}\left('\mathrm{transformdata}',x↦\mathrm{log}\left(x+1\right)\right),'\mathrm{projection}'=\mathrm{LambertAzimuthalEqualArea}\right)$
 > 

References

 ISO 3166 Country Codes, International Organization for Standardization.

Compatibility

 • The DataSets[Builtin][WorldMap][ChoroplethMap] command was introduced in Maple 2017.