Statistics
HeatMap
generate heat maps
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
HeatMap(A, options, plotoptions)
A
-
data
options
(optional) equation(s) of the form option=value where option is one of color, range, rowlabels, or columnlabels; specify options for generating the heat map
plotoptions
options to be passed to the plots[display] command
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 : list or range
Specifies colors for the individual data sets. When a range of colors is given, the color associated with a datum is generated by interpolating between the two named colors based on the range of values in the data. For example if color=red..blue then the minimum values in the data will be red and the maximum values blue. If a list of colors is provided, the color associated with a datum is generated by interpolating uniformly through all named colors.
range : range, list of ranges, all, or bycolumn;
The option range indicates that the data is to interpreted as being in a specified range and also controls whether the mapping from value to color is applied to each column independently or to the data as a whole.
Option
Coloring applies
Meaning
Example
range=all
To all data
Same color range applied to all data, range inferred from data
range=a..b
Same explicit color range a..b applied to all data
range=1..2
range=bycolumn
Columnwise
Each column has its own color range inferred from data
range=[a..b,c..d,...]
Each column has its own explicit color range
range=[1..2,3..4]
When ranges are inferred, the minimum data value and the maximum data value from the data are used. If a specified range is used and data values are outside of this range, they are truncated to nearest endpoint of the specified range.
columnlabels : list
Specifies the labels corresponding to each column. The list can contain either strings or names.
rowlabels : list
Specifies the labels corresponding to each row. The list can contain either strings or names.
The HeatMap command generates a heat map for the specified data. A heat map is a method of data visualization representing the magnitude of included data as a discrete density plot.
The first parameter A is a numeric Matrix, a list of lists, or a DataFrame.
with⁡Statistics:
Generate a heat map for a random matrix.
RM≔LinearAlgebra:-RandomMatrix⁡10:
The command to create the plot from the Plotting Guide using the data above is
HeatMap⁡RM
Generate the same heat map, sampling colors from blue to white to red.
HeatMap⁡RM,color=blue,white,red
Generate visualization to compare the correlation between three data sets.
U≔seq⁡0..10:V≔seq⁡sin⁡i,i=0..10:W≔seq⁡cos⁡i,i=0..10:
M≔Matrix⁡U,V,W:
CM≔CorrelationMatrix⁡M,ignore
CM≔
HeatMap⁡CM,columnlabels=n,sin(n),cos(n),rowlabels=n,sin(n),cos(n)
Compare intensities of absolute crime numbers for Canadian provinces.
CanadaCrime≔Import⁡datasets/canada_crimes.csv,base=datadir:
Statistics:-HeatMap⁡CanadaCrime1..10,..,color=white..red,size=900,300
Visualize the same crime statistics using the same color shading for all types of crime.
Statistics:-HeatMap⁡CanadaCrime1..10,..,color=white..red,range=all,size=900,300
Compare the similarity of words for "water" in several languages using the Levenshtein distance.
Words≔acqua,agua,eau,su,Wasser,water,woda,vatten,voda
WordDistances≔DataFrame⁡Matrix⁡numelems⁡Words,i,j↦StringTools:−Levenshtein⁡Wordsi,Wordsj,rows=Words,columns=Words:
Statistics:-HeatMap⁡WordDistances,size=800,400,color=blue..white,range=all
The Statistics[HeatMap] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
plots[listdensityplot]
Statistics/Visualization
Statistics[CorrelationMatrix]
Statistics[PieChart]
Download Help Document