Statistics - Maple Programming Help

Home : Support : Online Help : Graphics : Statistics : Statistics/TreeMap

Statistics

 TreeMap
 generate tree maps

 Calling Sequence TreeMap(X, options, plotoptions)

Parameters

 X - data options - (optional) equation(s) of the form option=value where option is one of color or datasetlabels; specify options for generating the tree map plotoptions - options to be passed to the plots[display] command

Description

 • The TreeMap command generates a tree map for the specified data. A tree map is a method of data visualization using nested rectangles, in which the area of a rectangle corresponds to the the magnitude of the corresponding datum.
 • The first parameter X is a list or Vector of equations; the left-hand side of each equation specifies a value and the right-hand side the associated frequency.
 • The right-hand side of an input equation can also contain another list or Vector of values; this imposes a hierarchical ordering on the data.

Options

 The options argument can contain one or more of the options shown below. All unrecognized options will be passed to the plots[display] command. See plot[options] for details.
 • color=name, list, or range
 This option specifies colors for the individual data sets. When a list of colors is given, each of the rectangles will be colored with the corresponding color in the list. If a range of colors is given, the colors will be generated by selecting an appropriate number of equally spaced points in the corresponding hue range.
 • datasetlabels=default, none, relative, absolute, or list
 This option controls data set labels on the tree map rectangles. By default, TreeMap uses data values as labels. The relative option will display, for each rectangle, the percentage value that rectangle occupies in the overall rectangle. The absolute option will display, for each rectangle, the absolute frequency of the corresponding value. Finally, one can specify data set labels as a list of strings.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $\mathrm{TreeMap}\left(\left["A"=6,"B"=6,"D"=4,"E"=3,"F"=2,"G"=2,"H"=1\right]\right)$

View the character frequencies in the word honorificabilitudinitatibus.

 > $T≔\left[\mathrm{StringTools}:-\mathrm{CharacterFrequencies}\left("honorificabilitudinitatibus"\right)\right]$
 ${T}{≔}\left[{"a"}{=}{2}{,}{"b"}{=}{2}{,}{"c"}{=}{1}{,}{"d"}{=}{1}{,}{"f"}{=}{1}{,}{"h"}{=}{1}{,}{"i"}{=}{7}{,}{"l"}{=}{1}{,}{"n"}{=}{2}{,}{"o"}{=}{2}{,}{"r"}{=}{1}{,}{"s"}{=}{1}{,}{"t"}{=}{3}{,}{"u"}{=}{2}\right]$ (1)
 > $\mathrm{TreeMap}\left(T,\mathrm{color}="Crimson".."Gold"\right)$

View a list of available food items, classified into categories and displayed accordingly.

 > $\mathrm{TreeMap}\left(\left["Fruits"=\left["Apples"=2,"Bananas"=2,"Oranges"=5\right],"Vegetables"=\left["Carrots"=3,"Potatoes"=3\right],"Eggs"=12\right]\right)$

View the relative populations of the provinces and territories of Canada.

 > $\mathrm{CanadaPopulation}≔\left["Alberta"=4121.7,"British Columbia"=4631.3,"Newfoundland and Labrador"=527.0,"Prince Edward Island"=146.3,"Manitoba"=1282.0,"New Brunswick"=753.9,"Northwest Territories"=43.6,"Nova Scotia"=942.7,"Nunavut"=36.6,"Ontario"=13678.7,"Quebec"=8214.7,"Saskatchewan"=1125.4,"Yukon"=36.5\right]:$
 > $\mathrm{TreeMap}\left(\mathrm{CanadaPopulation},\mathrm{color}=\mathrm{blue}..\mathrm{red}\right)$

View the relative size of files in the videos folder installed with Maple.

 > $\mathrm{with}\left(\mathrm{FileTools}\right):$
 > $\mathrm{VideoList}≔\mathrm{Size}\left(\mathrm{JoinPath}\left(\left["videos"\right],\mathrm{base}=\mathrm{datadir}\right),\mathrm{recursive},\mathrm{depth}=1\right)$
 ${\mathrm{VideoList}}{≔}\left[{"/usr/local/repository/build/rdgetroll8/maple/slot0/data/videos/videoplayer.mp4"}{=}{3343432}{,}{"/usr/local/repository/build/rdgetroll8/maple/slot0/data/videos/world.mp4"}{=}{3139798}\right]$ (2)
 > $\mathrm{VideoList}≔\mathrm{evalindets}\left(\mathrm{VideoList},\mathrm{string},\mathrm{Filename}\right)$
 ${\mathrm{VideoList}}{≔}\left[{"videoplayer.mp4"}{=}{3343432}{,}{"world.mp4"}{=}{3139798}\right]$ (3)
 > $\mathrm{TreeMap}\left(\mathrm{VideoList}\right)$
 > 

Compatibility

 • The Statistics[TreeMap] command was introduced in Maple 2015.