File Exchange

image thumbnail


version (11.7 KB) by Will Adler
Make a corner plot of samples in high dimensional spaces


Updated 28 May 2018

GitHub view license on GitHub

Cornerplot takes a nSamples-by-nDimensions array, and makes density plots of every combination of the dimensions.
This is especially useful when using MCMC; you can see how the parameters in your model interact, and whether there are any tradeoffs between them.
Inspired by ( by Dan Foreman-Mackey (

Cite As

Will Adler (2020). Cornerplot (, GitHub. Retrieved .

Comments and Ratings (5)

Tien Tran

Can you give a attached example to this code? I am a new one, if you can, please send to my email


Really nice, thank you.

Will Adler

Nice catch, Ben. Fixed it. Thanks!

Ben Dichter

I found a small bug: The diagonal histograms do not respect user-specified bounds.

I fixed it with the following insertion at line 100:

data2hist = data(:,i);
data2hist(data2hist < bounds(1,i) | data2hist > bounds(2,i)) = NaN;
[n,x] = hist(data2hist, hist_bins);


new histogram style

updated screenshot

formatting, title

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: kernel density estimation

Inspired: Ensemble MCMC sampler