A function to plot the distribution of 2-dimensional data.
Updated 6 Sep 2013

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

cloudPlot will help visualize the distribution of a 2-dimensional dataset. It is especially helpful when looking at extremely large datasets where a redular plot(x,y,'.') will just fill the plot with a solid color because the measurement points overlap each other.

cloudPlot uses the built-in matlab routines to set the axis limits and grid points appropriate to the data.

Cite As

Daniel Armyr (2024). cloudPlot (, MATLAB Central File Exchange. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!


Version Published Release Notes

Added more flexible arguments and more error handling after suggestions by Eric Sampson

Updated with more suggestions from Romesh to remove the need to return scaling factor. Made compatible with hold states and incldued more demos.

Thanks to Eric for the addition of the xscale/yscale output option.

Thanks to Romesh who provided a bugfix, the bins input option, and the ability to resize the plot.

Did a one-line fix that in certain cases speeds up the function by a factor of 5.

Improved the bin-size selection to make manual selection redundant.
Added proper handling of NANs and INFs
Added option to select axis limits and logarithmic colormap.

Now NaNs and Infs are handled gracefully.