heatmap_scatter

Simple scatter function with heatmap. Allows for custom colormaps.

You are now following this Submission

This is a simple wrapper around the scatter function that uses a Euclidean distance metric to count the number of entries in its proximity as a third dimension, which is represented by color.
It's fairly barebone, requiring your X and Y entries to be Nx1 vectors of identical length. It attempts to ignore outliers, but will do poorly if your data spans multiple orders of magnitude and you need to use log X or Y scale.
To test it out, just get your data into two Nx1 vectors and plug it in, you can tweak the needed settings from there.
Note that, if you want to enter graph settings such as marker size and color map but want automated distance thresholding, use [] for that argument.
It allows you to plug the graph directly into a subplot if you first make a subplot with:
sub_ax = subplot(n,n,i);
heatmap_scatter(x_vals, y_vals, [], false, 10, 'jet',sub_ax)

Hope it helps!

Cite As

gchao (2026). heatmap_scatter (https://www.mathworks.com/matlabcentral/fileexchange/89172-heatmap_scatter), MATLAB Central File Exchange. Retrieved .

Tags

Add Tags

Add the first tag.

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.1

Fixed description

1.1.0

Removed the previously very aggressive auto scaling function for x and y axis limits. Users can use xlim and ylim to do this manually. Added a field for linear vs log coloring for scatters that vary in density variation in orders of magnitudes.

1.0.0