hexscatter.m

Versión 1.1.0.0 (5,15 KB) por Gordon
Generate a density plot using hexagonal patches.
1,4K descargas
Actualizado 24 feb 2014

Ver licencia

When the number of elements in a scatter plot is large, the plot becomes saturated, and the true shape of the data becomes obscured. One solution is to use a density plot, where the intensity of colored patches indicates the number of points falling withing 2D bins.
HEXSCATTER generates a density plot using hexagonal bins. Hexagonal bins are often preferred over square bins because they better maintain the original look and feel of a scatter plot, as opposed to looking like a heatmap.
Syntax
hexscatter(xdata, ydata)
hexscatter(xdata, ydata, 'Name', Value, ...)
h = hexscatter(...)

Description
hexscatter(xdata, ydata) creates a density plot of the ydata versus the
xdata using hexagonal tiles. xdata and ydata should be vectors. NaN
values (and their corresponding values in the other vector) are ignored.

hexscatter(xdata, ydata, 'Name', Value, ...) accepts name-value pairs of
arguments from the following list (defaults in {}):
'xlim' { [min(xdadta(:) max(xdata(:))] } - a 2-element vector containing
the lower and upper bounds of the 2nd dimension of the grid.
'ylim' { [min(ydadta(:) max(ydata(:))] } - a 2-element vector containing
the lower and upper bounds of the 1st dimension of the grid.
'res' { 50 } - the resolution, or number of bins in each dimension. The
total number of bins will be the resolution squared.
'drawEdges' { false } - if true, edges are drawn around each hexagonal
patch.
'showZeros' { false } - if true, bins with 0 counts are shaded; if
false, only bins with non-zero counts are colored.

h = hexscatter( ... ) returns the object handle to the patch object
created.

Examples
hexscatter(rand(2000,1), rand(2000,1))

hexscatter(rand(2000,1), rand(2000,1), 'res', 90)

Also available in the Bean Matlab Toolkit:
https://github.com/brazilbean/bean-matlab-toolkit

Citar como

Gordon (2024). hexscatter.m (https://www.mathworks.com/matlabcentral/fileexchange/45639-hexscatter-m), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2013b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Polygons en Help Center y MATLAB Answers.
Agradecimientos

Inspiración para: Honeycomb

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.1.0.0

Added dependencies: default_param, get_params

1.0.0.0