Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

HeatMap

Display heat map of matrix data and create HeatMap object

Syntax

HMobj = HeatMap(Data)

HeatMap(Data, ...'RowLabels', RowLabelsValue, ...)
HeatMap(Data, ...'ColumnLabels', ColumnLabelsValue, ...)
HeatMap(Data, ...'Standardize', StandardizeValue, ...)
HeatMap(Data, ...'Colormap', ColormapValue, ...)
HeatMap(Data, ...'DisplayRange', DisplayRangeValue, ...)
HeatMap(Data, ...'Symmetric', SymmetricValue, ...)
HeatMap(Data, ...'ImputeFun', ImputeFunValue, ...)
HeatMap(Data, ...'RowLabelsColor', RowLabelsColorValue, ...)
HeatMap(Data, ...'ColumnLabelsColor', ColumnLabelsColorValue, ...)
HeatMap(Data, ...'LabelsWithMarkers', LabelsWithMarkersValue, ...)

Arguments

DataDataMatrix object or numeric matrix of data.
RowLabelsValueVector of numbers or cell array of character vectors to label the rows in the heat map. Default is a vector of values 1 through M, where M is the number of rows in Data.
ColumnLabelsValueVector of numbers or cell array of character vectors to label the columns in the heat map. Default is a vector of values 1 through N, where N is the number of columns in Data.
StandardizeValue

Character vector or number specifying the dimension for standardizing the values in Data. The HeatMap function transforms the standardized values so that the mean is 0 and the standard deviation is 1 in the specified dimension. Choices are:

  • 'column' or 1 — Standardize along the columns of data.

  • 'row' or 2 — Standardize along the rows of data.

  • 'none' or 3 (default) — Do not standardize.

ColormapValue

Either of the following:

  • M-by-3 matrix of RGB values

  • Name of or handle to a function that returns a colormap, such as redgreencmap or redbluecmap

Default is redgreencmap, in which red represents values above the mean, black represents the mean, and green represents values below the mean of a row (gene) across all columns (samples).
DisplayRangeValue

Positive scalar that specifies the display range of standardized values. Default is the maximum absolute value in the input Data.

For example, if you specify 3, there is a color variation for values between –3 and 3, but values >3 are the same color as 3, and values < –3 are the same color as –3.

For example, if you specify redgreencmap for the 'Colormap' property, pure red represents values ≥ DisplayRangeValue, and pure green represents values ≤ –DisplayRangeValue.

SymmetricValueForces the color scale of the heat map to be symmetric around zero. Choices are true (default) or false.
ImputeFunValue

One of the following:

  • Name of a function that imputes missing data.

  • Handle to a function that imputes missing data.

  • Cell array where the first element is the name of or handle to a function that imputes missing data. The remaining elements are property name/property value pairs used as inputs to the function.

    Tip   If data points are missing, you can use the 'ImputeFun' property to impute the missing values.

RowLabelsColorValue

    Warning   This name-value pair will be removed in a future release.

    Tip   Set LabelsWithMarkers to true for colored markers instead of colored texts.

Structure or structure array containing color information for labeling the rows (y-axis) of the heat map. The structure or structures contain the following fields.

For a single structure:

  • Labels — Cell array of character vectors specifying row labels listed in the RowLabels property.

  • Colors — Character vector specifying a color for the row labels. If this field is empty, the default color (black) is used.

For a structure array, each structure must have a single element in each field.

  • Labels — Character vector specifying a row label listed in the RowLabels property.

  • Colors — Character vector specifying a color for the row label you specified in the Labels field. If this field is empty, the default color (black) is used.

For more information on specifying colors, see ColorSpec.
ColumnLabelsColorValue

    Warning   This name-value pair will be removed in a future release.

    Tip   Set LabelsWithMarkers to true for colored markers instead of colored texts.

Structure or structure array containing color information for labeling the columns (x-axis) of the heat map. The structure or structures contain the following fields.

For a single structure:

  • Labels — Cell array of character vectors specifying column labels listed in the ColumnLabels property.

  • Colors — Character vector specifying a color for the column labels. If this field is empty, the default color (black) is used.

For a structure array, each structure must have a single element in each field.

  • Labels — Character vector specifying a column label listed in the ColumnLabels property.

  • Colors — Character vector specifying a color for the column labels. If this field is empty, the default color (black) is used.

For more information on specifying colors, see ColorSpec.
LabelsWithMarkersValue

Controls the display of colored markers instead of colored text for the row labels and column labels. Choices are true or false (default).

Description

HMobj = HeatMap(Data) displays a heat map (2-D color image) of the data and returns an object containing the data and display properties.

HeatMap(Data, ...'PropertyName', PropertyValue, ...) calls HeatMap with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Enclose each PropertyName in single quotation marks. Each PropertyName is case insensitive. These property name/property value pairs are as follows:


HeatMap(Data, ...'RowLabels', RowLabelsValue, ...)
uses the contents of RowLabelsValue, a vector of numbers or cell array of character vectors, as labels for the rows in the heat map. Default is a vector of values 1 through M, where M is the number of rows in Data.

HeatMap(Data, ...'ColumnLabels', ColumnLabelsValue, ...) uses the contents of ColumnLabelsValue, a vector of numbers or cell array of text character vectors, as labels for the columns in the heat map. Default is a vector of values 1 through M, where M is the number of columns in Data.

HeatMap(Data, ...'Standardize', StandardizeValue, ...) specifies the dimension for standardizing the values in Data. The HeatMap function transforms the standardized values are so that the mean is 0 and the standard deviation is 1 in the specified dimension. StandardizeValue can be:

  • 'column' or 1 — Standardize along the columns of data.

  • 'row' or 2 — Standardize along the rows of data.

  • 'none' or 3 (default) — Do not standardize.

HeatMap(Data, ...'Colormap', ColormapValue, ...) specifies the colormap to use to create the heat map. The colormap controls the colors used to display the heat map. ColormapValue is either an M-by-3 matrix of RGB values or the name of or handle to a function that returns a colormap, such as redgreencmap or redbluecmap. Default is redgreencmap.

    Note:   In redgreencmap, red represents values above the mean, black represents the mean, and green represents values below the mean of a row (gene) across all columns (samples). In redbluecmap, red represents values above the mean, white represents the mean, and blue represents values below the mean of a row (gene) across all columns (samples).

HeatMap(Data, ...'DisplayRange', DisplayRangeValue, ...) specifies the display range of standardized values. DisplayRangeValue must be a positive scalar. Default is the maximum absolute value in the input Data. For example, if you specify 3, there is a color variation for values between –3 and 3, but values >3 are the same color as 3, and values < –3 are the same color as –3.

For example, if you specify redgreencmap for the 'Colormap' property, pure red represents values ≥ DisplayRangeValue, and pure green represents values ≤ –DisplayRangeValue.

HeatMap(Data, ...'Symmetric', SymmetricValue, ...) controls whether the color scale of the heat map is symmetric around zero. SymmetricValue can be true (default) or false.

HeatMap(Data, ...'ImputeFun', ImputeFunValue, ...) specifies a function and optional inputs that impute missing data. ImputeFunValue can be any of the following:

  • Name of a function that imputes missing data.

  • Handle to a function that imputes missing data.

  • Cell array where the first element is the name of or handle to a function that imputes missing data. The remaining elements are property name/property value pairs used as inputs to the function.

    Tip   If data points are missing, you can use the 'ImputeFun' property to impute the missing values.

HeatMap(Data, ...'RowLabelsColor', RowLabelsColorValue, ...) specifies color information for labeling the rows (y-axis) of the heat map.

    Warning   This name-value pair will be removed in a future release. Set LabelsWithMarkers to true for colored markers instead of colored text.

HeatMap(Data, ...'ColumnLabelsColor', ColumnLabelsColorValue, ...) specifies color information for labeling the columns (x-axis) of the heat map.

    Warning   This name-value pair will be removed in a future release. Set LabelsWithMarkers to true for colored markers instead of colored text.

HeatMap(Data, ...'LabelsWithMarkers', LabelsWithMarkersValue, ...) controls the display of colored markers instead of colored text for the row labels and column labels. Choices are true or false (default).

Examples

collapse all

This example shows plot a heatmap of a data matrix

Create a matrix of data.

data = gallery('invhess',20);

Display a 2-D color image of the data.

hmo = HeatMap(data)
             Standardize: '[column | row | {none}]'
               Symmetric: '[true | false].'
            DisplayRange: 'Scalar.'
                Colormap: []
               ImputeFun: 'string -or- function handle -or- cell array'
            ColumnLabels: 'Cell array of strings, or an empty cell array'
               RowLabels: 'Cell array of strings, or an empty cell array'
      ColumnLabelsRotate: []
         RowLabelsRotate: []
                Annotate: '[on | {off}]'
          AnnotPrecision: []
              AnnotColor: []
       ColumnLabelsColor: 'A structure array.'
          RowLabelsColor: 'A structure array.'
       LabelsWithMarkers: '[true | false].'
    ColumnLabelsLocation: '[ top | {bottom} ]'
       RowLabelsLocation: '[ {left} | right ]'

HeatMap object with 20 rows and 20 columns.

More About

Introduced in R2009b

Was this topic helpful?