File Exchange

image thumbnail


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


Updated 28 May 2018

From GitHub

View Version History

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 (2021). Cornerplot (, GitHub. Retrieved .

Comments and Ratings (6)

Rod Letchford

This is an excellent function.
How can I change it so that instead of contour / density plots I get scatter plots?

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);

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

Inspired by: kernel density estimation

Inspired: Ensemble MCMC sampler

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!