Credits | Overview | Plotting Styles | Commands | Terminals
--- | --- | --- | --- | ---

## heatmaps

Several of gnuplot's plot styles can be used to create heat maps. The choice of which style to use is dictated by the type of data.

Pixel-based heat maps all have the property that each pixel in the map corresponds exactly to one original data value. The pixel-based image styles require a regular rectangular grid of data values; see with image. However it is possible to handle missing grid values (see sparse) and it is also possible to mask out only a portion of the grid for display (see masking). Unless there are a large number of grid elements, it is usually good to render each rectangular element separately (with image pixels) so that smoothing or lossy compression is not applied to the resulting "image".

A polar equivalent to image pixel-based heat maps can be generated using 2D plot style sectors. Each input point corresponds to exactly one annular sector of a polar grid, equivalent to a pixel. Unlike the polar grid surface option described below, any number of individual grid sectors may be provided. This plot style can be used in either polar or cartesian coordinate plots to place polar sectors anywhere on the graph. The figure here shows two halves of a polar heat map displaced across the origin by +/- Δx on a cartesian coordinate plot. See with sectors.

If the data points do not constitute a regular rectangular grid, they can often be used to fit a gridded surface by interpolation or by splines. Alternatively a point-density function can be mapped onto a gridded plane or smooth surface. See set dgrid3d. The gridded surface can then be plotted as a pm3d surface (see masking example). In this case the points on the heat map do not retain a one-to-one correspondence with the input data. I.e. the validity of the heat map represenation is only as good as the gridded approximation. The demo collection has examples of generating 2D heatmaps from a set of points heatmap_points.dem

If your copy of gnuplot was built with the --enable-polar-grid option, polar coordinate data points can be used to generate a 2D polar heat map in which each "pixel" corresponded to a pre-determined range of theta and r. See set polar grid and with surface. This process is exactly analogous to the use of set dgrid3d and with pm3d except that it operates in 2D polar coordinate space.