creates an array of smooth density histograms by plotting the data columns against each other in pairs.

Details and Options

  • PairwiseSmoothDensityHistogram is a form of plot matrix.
  • It plots high-dimensional data by creating a grid of individual plots of just two data columns at a time.
  • The plot compares column yi={y1i,y2i,,ymi} against column yj={y1j,y2j,,ymj} by plotting a smooth density histogram of the points {ykj,yki} in panel {i,j}.
  • The panel at row and column shows how the data columns yi and yj relate to each other. There are different types of features of the data that can be identified from those panels. Once the feature has been identified, it can also be quantified by further analysis of the data.
  • Correlation and covariance are measures of dependence between variables:
  • Use Correlation and Covariance to do detailed analysis of correlation.
  • The density of points is a measure of the number of points per unit area. The panels in PairwiseSmoothDensityHistogram effectively show the two-dimensional marginal densities:
  • Use PairwiseDensityHistogram and PairwiseSmoothDensityHistogram to more directly visualize the densities.
  • Clusters are groups of similar points, indicating categories:
  • PairwiseSmoothDensityHistogram takes the same options as Graphics, with the following changes and additions:
  • AspectRatio 1ratio of height to width for each panel
    BackgroundNonebackground to use for each plot
    FrameAutomaticwhether to draw frames around each panel
    FrameTicksAutomaticwhether to label frame edges with ticks and labels
    GridLines Automaticwhether to include gridlines in panels
    GridLinesStyleAutomaticstyle for gridlines
    HeaderAlignmentCenterhorizontal and vertical alignments of headers
    HeaderBackground Automaticbackground colors to use for headers
    HeaderDisplayFunctionAutomaticfunction to use to format headers
    Headers Automaticlabels to use for each data column yi
    HeaderStyleNonestyles to use for headers
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotHighlightingAutomatichighlighting effect for points
    PlotLayout Automatichow to arrange the panels
    PlotLegendsAutomaticlegends for data
    PlotMarkersNonemarkers to use to indicate each point
    PlotStyleAutomaticgraphics directives to determine styles of points
    PlotTheme $PlotThemeoverall theme for the plot
    Spacings Automatichorizontal and vertical spacings
  • PlotLayout can have the following settings:
  • "Descending"data columns going down and to the right
    "Ascending"data columns going up and to the right
    "DescendingHalfMatrix"lower half of the descending layout
    "AscendingHalfMatrix"upper half of the ascending layout
  • Headers specifies the labels to use for each column in the data, and will generally be displayed above each column and after each row in the final plot.
  • Possible settings include:
  • Noneleave the plot columns and rows unlabeled
    Automaticautomatically label columns and rows
    Allalways include column and row labels
    "Indexed"number the columns and rows 1, 2, , n
    {lbl1,lbl2,,lbln}use the given labels lbli
  • HeaderAlignment determines how data column labels are aligned with regard to the plot columns and rows.
  • HeaderAlignment can take the following forms:
  • Centercenter the labels in the header positions
    {h,v}separate horizontal and vertical alignments within the header position
    {cols,rows}use col for plot columns and row for plot rows
  • HeaderBackground and HeaderStyle can take the following forms:
  • Noneuse ambient styling
    styuse the style sty for all headers
    {sty1,sty2,,styn}use the given styles styi for successive headers
    {cols,rows}use col for plot columns and row for plot rows
  • HeaderDisplayFunction determines how headers are displayed.
  • Possible settings are:
  • Automaticautomatic formatting
    Noneuse unprocessed labels
  • The arguments to ColorFunction are yi1,yi2,,yin. By default, the color function arguments are scaled per data column to be between 0 and 1.
  • Use ColorFunctionScalingNone to use unscaled values, or ColorFunctionScaling{cfsc1,cfsc2,} to selectively scale column values.
  • Possible settings for PlotHighlighting include:
  • Automaticautomatically highlight positions in the panels
    Nonedisable interactive highlighting


open allclose all

Basic Examples  (3)

Create an array of smooth density histograms from data with labeled columns:

Compare all columns in a dataset:

Provide header names for the data:

Scope  (2)

Data  (2)

Plot datasets:

Plot arrays of values:

Options  (19)

AspectRatio  (2)

By default, PairwiseSmoothDensityHistogram uses an equal height-to-width ratio:

Use a fixed height-to-width ratio:

ColorFunction  (3)

Color by scaled coordinate:

Specify gray-level intensity by scaled coordinate:

Use named color gradients:

GridLines  (2)

By default, PairwiseSmoothDensityHistogram does not draw gridlines:

Draw a grid on top of the plot:

Headers  (3)

By default, PairwiseSmoothDensityHistogram does not label columns:

Number the columns for unlabeled data:

Provide header names for the columns:

HeaderBackground  (2)

By default, PairwiseSmoothDensityHistogram uses a white header background:

Set a header background color:

PlotLabel  (1)

Add an overall label to the plot:

PlotLayout  (3)

Switch the orientation of the diagonal elements:

Show plots below the diagonal:

Only show plots above the diagonal:

PlotTheme  (2)

Use a theme with simple ticks and gridlines in a bright color scheme:

Change color scheme:

Spacings  (1)

Change the space between the plots:

Wolfram Research (2023), PairwiseSmoothDensityHistogram, Wolfram Language function,


Wolfram Research (2023), PairwiseSmoothDensityHistogram, Wolfram Language function,


Wolfram Language. 2023. "PairwiseSmoothDensityHistogram." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2023). PairwiseSmoothDensityHistogram. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_pairwisesmoothdensityhistogram, author="Wolfram Research", title="{PairwiseSmoothDensityHistogram}", year="2023", howpublished="\url{}", note=[Accessed: 30-May-2024 ]}


@online{reference.wolfram_2024_pairwisesmoothdensityhistogram, organization={Wolfram Research}, title={PairwiseSmoothDensityHistogram}, year={2023}, url={}, note=[Accessed: 30-May-2024 ]}