Statistics Glossary → Hexbin Map
Hexbin Mapanalysis
A spatial summary map that divides the study area into equal-sized hexagonal cells and colours each cell by the number of points it contains (or by the sum, mean or median of a value).
Concept
When many points overlap on a map, differences in density vanish: a neighbourhood with a thousand points and one with fifty can look like the same black smudge. A hexbin map divides the area into a lattice of regular hexagons and counts the points in each cell, so density is read directly from the cell's colour. If a value column is chosen, a cell can also show the total, mean or median value of the points within it.
Hexagons are used because their edges are more evenly distant from the centre than a square's, and each hexagon shares a border equally with its six neighbours; this reduces the corner effects of a square grid. Cell size is the most important choice: small cells keep detail but leave only one or two points in most cells, while large cells smooth the pattern but merge local differences. The colour classification (equal interval, quantile, natural breaks) further affects how the map is perceived.
The method is descriptive: it does not test whether the differences in density could arise by chance. The result depends on the cell size and on where the lattice starts (the modifiable areal unit problem), so trying several cell sizes is advisable. Cell counts should not be read as rates or risks without taking into account a quantity 'at risk', such as the population or land use in each cell.
When to use it
- To show clearly the spatial density of a large number of points, or a cell-level summary of a value measured at the points.
- If a continuous density surface without cell boundaries is wanted, use the KDE density map.
- If it is to be tested whether dense cells are statistically significant hot spots, use Getis-Ord Gi* (which can also work on cell counts); if the points are to be split into clusters, DBSCAN is preferred.
An everyday example
A provincial health directorate maps the locations of 1,200 pharmacies in a large city. In the centre the points are so close together that they look like one smudge, and it is unclear which districts have easier access to a pharmacy. A hexbin map divides the city into hexagons of roughly 1 km²: it shows at once that some central cells hold 25 pharmacies while a large area in a newly developed district has none. Choosing the monthly number of prescriptions as the value and showing the cell mean also reveals in which cells the workload per pharmacy is highest.
Parameters in MerQur
Classify by (none - single color, categorical column)
Concept: Shows the points in different colours according to a categorical column before the analysis. It is a data-exploration step and does not change the cell counts.
Everyday example: Colouring the pharmacies as 'can do night duty' and 'daytime only' lets one see, before the cell map is drawn, in which parts of the city night service is concentrated.
What it does: Provides data exploration by colouring the points by a categorical column.
Effect on the result: Does not change the cell table.
On the validation data: Not tested, since it does not enter the analysis.
Method (KDE, Hexbin, Getis-Ord Gi*, DBSCAN, Moran's I, Variogram + Kriging)
Concept: Chooses which spatial method is run on the map tab. Hexbin summarises points by counting them in regular cells; KDE gives a continuous surface, Gi* and Moran's I significance tests, DBSCAN clustering and kriging interpolation.
Everyday example: If the directorate's question is 'how dense are pharmacies in each cell of the city?', Hexbin is suitable. For the question 'are pharmacies significantly clustered?', Gi* is needed.
What it does: Selects the method in the Map tab; this section covers the Hexbin option.
Effect on the result: The other methods are covered in their own sections.
Grid (hexagons along x) (default 15)
Concept: Sets how many hexagons span the east-west extent, and hence the cell size. Small cells keep detail but give small, noisy counts; large cells make the counts stable but merge local differences.
Everyday example: Dividing the city into 5 hexagons lumps all the central pharmacies into one cell and hides differences between districts. With 200 hexagons almost every cell holds a single pharmacy and the map is no different from a point map; a size in between should be sought.
What it does: Determines the approximate number of hexagons along the east-west extent; controls the hexagon size. A very small cell falls to single points, a very large cell merges patterns.
Effect on the result: Changes the number of cells, the cell area and the count per cell.
On the validation data: In Boston, 3 hexagons: 13 filled cells, highest 228 points; 15: 129 / 41 (cell area 6.00 km2); 200: 499 / 3.
Cell value (Point count, Sum of values, Mean of values, Median)
Concept: Sets what a cell shows: the point count gives density, the value sum the total amount in the cell, and the mean and median the typical value in the cell. The median is less affected than the mean by a few extreme values in a cell.
Everyday example: The prescription sum shows total demand for medicines in a cell, while the mean shows the typical workload per pharmacy. If a cell contains one very large hospital pharmacy, the median better reflects the workload of the ordinary pharmacies there.
What it does: Shows in each cell the point count or the sum, mean or median of the value column. If sum/mean is selected without a value column, the interface warns; the run does not execute.
Effect on the result: Changes the cell colour value and the classification limits; does not change the cell geometry.
On the validation data: The highest CMEDV sum is 664.7; the highest mean and median are 50.0 (the data ceiling value).
Palette (Viridis, Plasma, Jet)
Concept: Sets the colour scale used to display the cell values; it does not change the computed counts. Perceptually uniform palettes (Viridis, Plasma) convey differences in value more faithfully than a rainbow palette (Jet).
Everyday example: In the Jet palette the same pharmacy map can make some mid-valued cells look more striking than they are. In Viridis the change from dark to light follows the rise in the number of pharmacies smoothly.
What it does: Determines the colour scale.
Effect on the result: Does not change the cell table (expected no effect).
Classification (Continuous colour, Equal interval, Quantile, Natural breaks (Jenks)) and number of classes
Concept: Classification splits continuous values into a set number of colour classes. Equal-interval classes are cut at the same width and are easy to interpret; quantiles put roughly the same number of cells in each class; natural breaks (Jenks) cut at natural gaps in the data, minimising within-class differences, and suit skewed distributions.
Everyday example: If most cells hold 1 or 2 pharmacies and a few hold more than 20, nearly all cells end up the same colour with equal intervals. Jenks also separates the cells with few pharmacies from one another, making the map more informative.
What it does: Divides cell values into equal interval, quantile or natural breaks (Jenks; exact Fisher dynamic programming) classes; the legend shows the limits and the number of cells per class. Equal interval suits interpretability, quantile balanced classes, Jenks skewed distributions.
Effect on the result: Changes only the colour classes and the legend; cell counts do not change.
On the validation data: Jenks 5-class limits 1/3/9/16/29/41; quantile and equal interval give the same limits at 9 classes.
→ Map classification methods (equal interval, quantile, natural breaks)
Minimum points (default 1)
Concept: Removes from the map the cells whose point count falls below the threshold. It can be used to hide unstable cell values based on very few observations, or to prevent individual records from being identified where personal data must be protected.
Everyday example: If the cell mean number of prescriptions is shown, the mean in a cell with one pharmacy is really that pharmacy's own figure. With a threshold of 3 such cells are hidden, and individual pharmacies' workloads cannot be read from the map.
What it does: Removes cells whose count is below the threshold from the map (1 = all are shown).
Effect on the result: Changes the number of cells shown, does not change cell values.
On the validation data: 75 cells (54 hidden) at threshold 2, 27 cells at 5; at 1000 all cells are hidden and an explicit error message is given.
Value (none, numeric column)
Concept: Sets which numeric column is summarised when the cell value is the sum, mean or median. It is not needed if only points are counted.
Everyday example: When the monthly prescriptions column is selected, the cells summarise not just the number of pharmacies but also the prescription load of the pharmacies in each cell.
What it does: Used only in the sum, mean and median cell values.
Effect on the result: Ignored when "Point count" is selected (same result).
Longitude convention (automatic)
Concept: Converts longitudes to a single convention (−180 to 180) and, for data crossing the 180th meridian, wraps longitude differences so that points on either side of the meridian remain neighbours on the same lattice.
Everyday example: For a city's pharmacies this rule has no effect. But for someone counting earthquake epicentres into cells around Pacific islands, without it the epicentres on either side of the meridian would fall into separate cells at opposite ends of the map.
What it does: Bins data given in the 0-360 form or crossing the 180th meridian after converting and wrapping.
Effect on the result: For data crossing the meridian all points fall into correctly placed cells; no point is dropped.
On the validation data: In quakes, all 1000 points (equirectangular plane, circular centre), 119 filled cells, highest 79 points.
Example on real data
Data: Harrison and Rubinfeld 1978, spData boston
Variables: 506 census tract centroids (latitude/longitude), value CMEDV (house value)
- Question: How are the 506 Boston census tract centroids concentrated in space?
- Method: Latitude-longitude is carried onto a local plane (km); 15 hexagons along the east-west extent, circumradius 1.52 km, cell area 6.0 km²; the cell value is the point count.
- Result: 129 cells are filled; the busiest cell holds 41 centroids, and most cells (54) hold only 1 centroid. Density is concentrated in the city centre.
- Descriptive: The count distribution is right-skewed (many sparsely filled cells, few densely filled cells); the colour scale can be made more readable with the classification option.
- Limitation: The result depends on the cell size and the lattice origin (modifiable areal unit problem); it should be checked with a different gridsize.
- Report line: On a 15-hexagon lattice (cell area 6.0 km²) the 506 points fell into 129 cells; the highest cell count was 41.
Related concepts
Percentiles (quantiles) and percentile definitionsMap classification methods (equal interval, quantile, natural breaks)Kernel density estimation (KDE)Kriging (simple, ordinary, universal, block)Spatial autocorrelation (Moran's I, Geary's C)Local indicators of spatial association (LISA) and Gi*Choosing the number of clusters
The numbers in the examples are MerQur's output on independent, publicly available validation data; see the MerQur Technical Note for details.