Function Repository Resource:

# MarginalPlot

Plot 2D data together with visualizations of the marginal distributions

Contributed by: Jon McLoone
 ResourceFunction["MarginalPlot"][data] produces a ListPlot of 2D data together with visualizations of the marginal distributions. ResourceFunction["MarginalPlot"][data,binspec] uses the bin specification binspec.

## Details and Options

ResourceFunction["MarginalPlot"] supports options of Graphics with the following additions:
 “MarginalChartType" Histogram the chart type used to display the marginal distributions “MarginalChartScale" 0.3 proportion of space provided for charts of marginal distributions “MarginalChartOptions" {} list of any options supported by the visualization used for the marginal distributions
Supported values for "MarginalChartType" are Histogram, DistributionChart and BoxWhiskerChart.
The binspec uses the same specification as the built-in function Histogram
The binspec is ignored if the "MarginalChartType" is not Histogram

## Examples

### Basic Examples (3)

See the marginal distributions of 2D data together with the data:

 In[1]:=
 Out[1]=

Display the marginal distributions using DistributionChart:

 In[2]:=
 Out[2]=

Display the marginal distributions using BoxWhiskerChart:

 In[3]:=
 Out[3]=

### Scope (3)

Specify the number of bins for Histogram marginal plots:

 In[4]:=
 Out[5]=

Specify the bin widths:

 In[6]:=
 Out[6]=

Mix different types of visualization for the different marginal distributions:

 In[7]:=
 Out[8]=
 In[9]:=
 Out[10]=

### Options (3)

The type of chart used to display the marginal distribution is controlled with "MarginalChartType". Choices available are Histogram, DistributionChart and BoxWhiskerChart:

 In[11]:=
 Out[11]=

A list of two different values can be given for "MarginalChartType":

 In[12]:=
 Out[12]=

The proportion of the plot space occupied by the Histogram elements is controlled by "MarginalChartScale":

 In[13]:=
 Out[14]=

Create larger histograms:

 In[15]:=
 Out[15]=

Standard Graphics options are supported:

 In[16]:=
 Out[17]=

All standard options for the visualizations used for the marginal distributions are supported and must be passed in using the option "MarginalChartOptions":

 In[18]:=
 Out[18]=

Likewise, options for DistributionChart and BoxWhiskerChart are supported:

 In[19]:=
 Out[19]=
 In[20]:=
 Out[20]=

Jon McLoone

## Version History

• 1.1.0 – 22 February 2023
• 1.0.0 – 01 July 2022