File Exchange

image thumbnail

densityplot(x,y,var​argin)

version 1.1 (1.44 KB) by Changyong He
density plot

49 Downloads

Updated 23 Nov 2017

View Version History

View License

This function is used to make density plot of scatter point data, which is based on build-in function hist3 in matlab. So the inputs of the function densityplot can refer to hist3. Some examples are given as below:
(1)
x = randn(2048, 1);
y = randn(2048, 1);
x(1:512) = x(1:512) + 2.75;
x(1537:2048) = x(1537:2048) + 2.75;
y(1025:2048) = y(1025:2048) + 2.75;
%
tic
densityplot(x, y, [20,20]);
toc
The advantage of this function is the high efficiency and its code is very simple. You can modify it according to your own requirement. Enjoy.

Cite As

Changyong He (2020). densityplot(x,y,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/65166-densityplot-x-y-varargin), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Jeffrey Levinton

I try this and get this message using densityplot:
unrecognized function or variable 'densityplot'.
As if it does not exist.

Noa Burshtein

Marcus Rosales

Thanks for the reply! I will try this out since I do have a university license and it seems to have more control of what I want to see.

Marc

I can't necessarily recommend this, since it functions off of hist3, which requires a license

MartinFJFI

Stunning! Thanks, Changyong.

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!